Improve TestPatch to use git read-tree -m and implement git-merge-one-file functionality (#18004)
The current TestPatch conflict code uses a plain git apply which does not properly account for 3-way merging. However, we can improve things using `git read-tree -m` to do a three-way merge then follow the algorithm used in merge-one-file. We can also use `--patience` and/or `--histogram` to generate a nicer diff for applying patches too. Fix #13679 Fix #6417 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
487ce3b49e
commit
f1e85622da
3 changed files with 377 additions and 6 deletions
|
@ -237,7 +237,11 @@ func (repo *Repository) GetDiff(base, head string, w io.Writer) error {
|
|||
|
||||
// GetDiffBinary generates and returns patch data between given revisions, including binary diffs.
|
||||
func (repo *Repository) GetDiffBinary(base, head string, w io.Writer) error {
|
||||
return NewCommandContext(repo.Ctx, "diff", "-p", "--binary", base, head).
|
||||
if CheckGitVersionAtLeast("1.7.7") == nil {
|
||||
return NewCommandContext(repo.Ctx, "diff", "-p", "--binary", "--histogram", base, head).
|
||||
RunInDirPipeline(repo.Path, w, nil)
|
||||
}
|
||||
return NewCommandContext(repo.Ctx, "diff", "-p", "--binary", "--patience", base, head).
|
||||
RunInDirPipeline(repo.Path, w, nil)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue