Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2018-02-14 21:52:06 +0300
committerJunio C Hamano <gitster@pobox.com>2018-02-28 01:11:58 +0300
commitc5b761fb2711542073cf1906c0e86a34616b79ae (patch)
treef127a060756cb53996de66d88e58a8d740118bdf /merge-recursive.c
parentfebb3a86098f853066c2623c2392f156710dd40f (diff)
merge-recursive: ensure we write updates for directory-renamed file
When a file is present in HEAD before the merge and the other side of the merge does not modify that file, we try to avoid re-writing the file and making it stat-dirty. However, when a file is present in HEAD before the merge and was in a directory that was renamed by the other side of the merge, we have to move the file to a new location and re-write it. Update the code that checks whether we can skip the update to also work in the presence of directory renames. Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 4a1ecdea03..5f42c677d5 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -2763,7 +2763,6 @@ static int merge_content(struct merge_options *o,
if (mfi.clean && !df_conflict_remains &&
oid_eq(&mfi.oid, a_oid) && mfi.mode == a_mode) {
- int path_renamed_outside_HEAD;
output(o, 3, _("Skipped %s (merged same as existing)"), path);
/*
* The content merge resulted in the same file contents we
@@ -2771,8 +2770,7 @@ static int merge_content(struct merge_options *o,
* are recorded at the correct path (which may not be true
* if the merge involves a rename).
*/
- path_renamed_outside_HEAD = !path2 || !strcmp(path, path2);
- if (!path_renamed_outside_HEAD) {
+ if (was_tracked(path)) {
add_cacheinfo(o, mfi.mode, &mfi.oid, path,
0, (!o->call_depth), 0);
return mfi.clean;