зеркало из https://github.com/microsoft/git.git
conflict_rename_delete(): Check whether D/F conflicts are still present
If all the paths below some directory involved in a D/F conflict were not removed during the rest of the merge, then the contents of the file whose path conflicted needs to be recorded in file with an alternative filename. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
71f7ffcc02
Коммит
a0de2f6bd3
|
@ -807,6 +807,8 @@ static void conflict_rename_delete(struct merge_options *o,
|
|||
const char *other_branch)
|
||||
{
|
||||
char *dest_name = pair->two->path;
|
||||
int df_conflict = 0;
|
||||
struct stat st;
|
||||
|
||||
output(o, 1, "CONFLICT (rename/delete): Rename %s->%s in %s "
|
||||
"and deleted in %s",
|
||||
|
@ -817,7 +819,13 @@ static void conflict_rename_delete(struct merge_options *o,
|
|||
rename_branch == o->branch1 ? pair->two : NULL,
|
||||
rename_branch == o->branch1 ? NULL : pair->two,
|
||||
1);
|
||||
if (lstat(dest_name, &st) == 0 && S_ISDIR(st.st_mode)) {
|
||||
dest_name = unique_path(o, dest_name, rename_branch);
|
||||
df_conflict = 1;
|
||||
}
|
||||
update_file(o, 0, pair->two->sha1, pair->two->mode, dest_name);
|
||||
if (df_conflict)
|
||||
free(dest_name);
|
||||
}
|
||||
|
||||
static void conflict_rename_rename_1to2(struct merge_options *o,
|
||||
|
|
|
@ -549,7 +549,7 @@ test_expect_success 'setup both rename source and destination involved in D/F co
|
|||
git commit -m "Conflicts in the way"
|
||||
'
|
||||
|
||||
test_expect_failure 'both rename source and destination involved in D/F conflict' '
|
||||
test_expect_success 'both rename source and destination involved in D/F conflict' '
|
||||
git reset --hard &&
|
||||
rm -rf dir~* &&
|
||||
git checkout -q rename-dest^0 &&
|
||||
|
@ -589,7 +589,7 @@ test_expect_success 'setup pair rename to parent of other (D/F conflicts)' '
|
|||
git commit -m "Rename one/file -> two"
|
||||
'
|
||||
|
||||
test_expect_failure 'pair rename to parent of other (D/F conflicts) w/ untracked dir' '
|
||||
test_expect_success 'pair rename to parent of other (D/F conflicts) w/ untracked dir' '
|
||||
git checkout -q rename-one^0 &&
|
||||
mkdir one &&
|
||||
test_must_fail git merge --strategy=recursive rename-two &&
|
||||
|
|
Загрузка…
Ссылка в новой задаче