mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
merge.h - improve handling when there is no ancestor in merge_file__best_path
In cases when a path is missing from the ancestor and only of the two children is defined (IOW, the object is added), then the path in the child that is defined should be returned. However, merge_file__best_path is only returning a path in cases when there is no ancestor path only if both children are defined and they match each other. Improve merge_file__best_path by handling the case when it is present in only one of the children paths returning this value.
This commit is contained in:
committed by
Edward Thomson
parent
0bd182129f
commit
b93afbc48f
@@ -165,6 +165,10 @@ GIT_INLINE(const char *) git_merge_file__best_path(
|
||||
if (!ancestor) {
|
||||
if (ours && theirs && strcmp(ours, theirs) == 0)
|
||||
return ours;
|
||||
if (ours && !theirs)
|
||||
return ours;
|
||||
if (theirs && !ours)
|
||||
return theirs;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user