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:
authorAlex Riesen <raa.lkml@gmail.com>2007-04-26 00:06:59 +0400
committerJunio C Hamano <junkio@cox.net>2007-04-26 10:43:16 +0400
commitc135ee88f8584996ead993c76015d2c03798ab9e (patch)
tree704d7f2fdac1166a25d5ab8ed73384cee7280f54 /merge-recursive.c
parent6169a89c4fd29cf9c747bab7bd310877328bc7e2 (diff)
Avoid excessive rewrites in merge-recursive
If a file is changed in one branch, and renamed and changed to the same content in another branch than we can skip the rewrite of this file in the working directory, as the content does not change. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 403a4c8bca..37f1ba93fe 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1342,20 +1342,26 @@ static int process_renames(struct path_list *a_renames,
mfi = merge_file(o, a, b,
a_branch, b_branch);
- if (mfi.merge || !mfi.clean)
- output(1, "Renamed %s => %s", ren1_src, ren1_dst);
- if (mfi.merge)
- output(2, "Auto-merged %s", ren1_dst);
- if (!mfi.clean) {
- output(1, "CONFLICT (rename/modify): Merge conflict in %s",
- ren1_dst);
- clean_merge = 0;
-
- if (!index_only)
- update_stages(ren1_dst,
- o, a, b, 1);
+ if (mfi.merge && mfi.clean &&
+ sha_eq(mfi.sha, ren1->pair->two->sha1) &&
+ mfi.mode == ren1->pair->two->mode)
+ output(3, "Skipped %s (merged same as existing)", ren1_dst);
+ else {
+ if (mfi.merge || !mfi.clean)
+ output(1, "Renamed %s => %s", ren1_src, ren1_dst);
+ if (mfi.merge)
+ output(2, "Auto-merged %s", ren1_dst);
+ if (!mfi.clean) {
+ output(1, "CONFLICT (rename/modify): Merge conflict in %s",
+ ren1_dst);
+ clean_merge = 0;
+
+ if (!index_only)
+ update_stages(ren1_dst,
+ o, a, b, 1);
+ }
+ update_file(mfi.clean, mfi.sha, mfi.mode, ren1_dst);
}
- update_file(mfi.clean, mfi.sha, mfi.mode, ren1_dst);
}
}
}