summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2adc7dc)
raw | patch | inline | side by side (parent: 2adc7dc)
author | Elijah Newren <newren@gmail.com> | |
Mon, 20 Sep 2010 08:29:07 +0000 (02:29 -0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 30 Sep 2010 00:37:05 +0000 (17:37 -0700) |
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>
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>
merge-recursive.c | patch | blob | history | |
t/t6022-merge-rename.sh | patch | blob | history |
diff --git a/merge-recursive.c b/merge-recursive.c
index 85d69eb5677c04635c7518cb0978cf3664e7dd96..a3f986d874e6ee703d989f7ab365b568ba09de7e 100644 (file)
--- a/merge-recursive.c
+++ b/merge-recursive.c
const char *reason = "content";
struct merge_file_info mfi;
struct diff_filespec one, a, b;
+ struct stat st;
+ unsigned df_conflict_remains = 0;
if (!o_sha) {
reason = "add/add";
b.mode = b_mode;
mfi = merge_file(o, &one, &a, &b, o->branch1, o->branch2);
- if (mfi.clean && sha_eq(mfi.sha, a_sha) && mfi.mode == a.mode)
+ if (df_rename_conflict_branch &&
+ lstat(path, &st) == 0 && S_ISDIR(st.st_mode)) {
+ df_conflict_remains = 1;
+ }
+
+ if (mfi.clean && !df_conflict_remains &&
+ sha_eq(mfi.sha, a_sha) && mfi.mode == a.mode)
output(o, 3, "Skipped %s (merged same as existing)", path);
else
output(o, 2, "Auto-merging %s", path);
reason, path);
}
- update_file(o, mfi.clean, mfi.sha, mfi.mode, path);
+ if (df_conflict_remains) {
+ const char *new_path;
+ update_file_flags(o, mfi.sha, mfi.mode, path,
+ o->call_depth || mfi.clean, 0);
+ new_path = unique_path(o, path, df_rename_conflict_branch);
+ mfi.clean = 0;
+ output(o, 1, "Adding as %s instead", new_path);
+ update_file_flags(o, mfi.sha, mfi.mode, new_path, 0, 1);
+ } else {
+ update_file(o, mfi.clean, mfi.sha, mfi.mode, path);
+ }
return mfi.clean;
}
index 0b6700242ce7faeb68ab0c6a1facf6460fb48634..422092e11c46c348d77d95e5a1b59a8e2e818101 100755 (executable)
--- a/t/t6022-merge-rename.sh
+++ b/t/t6022-merge-rename.sh
test_cmp expected dir
'
-test_expect_failure 'Rename+D/F conflict; renamed file merges but dir in way' '
+test_expect_success 'Rename+D/F conflict; renamed file merges but dir in way' '
git reset --hard &&
rm -rf dir~* &&
git checkout -q renamed-file-has-no-conflicts^0 &&
test_cmp expected dir~HEAD
'
-test_expect_failure 'Same as previous, but merged other way' '
+test_expect_success 'Same as previous, but merged other way' '
git reset --hard &&
rm -rf dir~* &&
git checkout -q dir-in-way^0 &&
test_cmp expected dir
'
-test_expect_failure 'Rename+D/F conflict; renamed file cannot merge and dir in the way' '
+test_expect_success 'Rename+D/F conflict; renamed file cannot merge and dir in the way' '
modify s/dir-not-in-way/dir-in-way/ expected &&
git reset --hard &&
>>>>>>> renamed-file-has-conflicts
EOF
-test_expect_failure 'Same as previous, but merged other way' '
+test_expect_success 'Same as previous, but merged other way' '
git reset --hard &&
rm -rf dir~* &&
git checkout -q dir-in-way^0 &&