aboutsummaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-04-28 14:11:35 -0700
committerJunio C Hamano <gitster@pobox.com>2011-04-28 14:11:35 -0700
commitac9666f84a597973ef29dc7f0f7edcb3e1a3aa45 (patch)
tree8603a2147eeff8893f88ff58a779e49dc9219e6b /merge-recursive.c
parentd98a509ec3e9ff22bb642f778900691d0c715ba9 (diff)
parentb9b3eef76186d423efb684d01b3e99ef010a61de (diff)
downloadgit-ac9666f84a597973ef29dc7f0f7edcb3e1a3aa45.tar.gz
git-ac9666f84a597973ef29dc7f0f7edcb3e1a3aa45.tar.xz
Merge branch 'en/merge-recursive'
* en/merge-recursive: merge-recursive: tweak magic band-aid merge-recursive: When we detect we can skip an update, actually skip it t6022: New test checking for unnecessary updates of files in D/F conflicts t6022: New test checking for unnecessary updates of renamed+modified files
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index af131508e..7c1267355 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -344,10 +344,11 @@ static void make_room_for_directories_of_df_conflicts(struct merge_options *o,
* make room for the corresponding directory. Such paths will
* later be processed in process_df_entry() at the end. If
* the corresponding directory ends up being removed by the
- * merge, then the file will be reinstated at that time;
- * otherwise, if the file is not supposed to be removed by the
- * merge, the contents of the file will be placed in another
- * unique filename.
+ * merge, then the file will be reinstated at that time
+ * (albeit with a different timestamp!); otherwise, if the
+ * file is not supposed to be removed by the merge, the
+ * contents of the file will be placed in another unique
+ * filename.
*
* NOTE: This function relies on the fact that entries for a
* D/F conflict will appear adjacent in the index, with the
@@ -358,6 +359,13 @@ static void make_room_for_directories_of_df_conflicts(struct merge_options *o,
int last_len = 0;
int i;
+ /*
+ * Do not do any of this crazyness during the recursive; we don't
+ * even write anything to the working tree!
+ */
+ if (o->call_depth)
+ return;
+
for (i = 0; i < entries->nr; i++) {
const char *path = entries->items[i].string;
int len = strlen(path);
@@ -1260,9 +1268,13 @@ static int merge_content(struct merge_options *o,
}
if (mfi.clean && !df_conflict_remains &&
- sha_eq(mfi.sha, a_sha) && mfi.mode == a.mode)
+ sha_eq(mfi.sha, a_sha) && mfi.mode == a.mode &&
+ !o->call_depth && !lstat(path, &st)) {
output(o, 3, "Skipped %s (merged same as existing)", path);
- else
+ add_cacheinfo(mfi.mode, mfi.sha, path,
+ 0 /*stage*/, 1 /*refresh*/, 0 /*options*/);
+ return mfi.clean;
+ } else
output(o, 2, "Auto-merging %s", path);
if (!mfi.clean) {