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>2010-09-20 12:28:51 +0400
committerJunio C Hamano <gitster@pobox.com>2010-09-30 04:32:38 +0400
commit5e3ce663b03bf14443ef8b4c60b407664f97040b (patch)
treea6139d700026f094ae73126fad0046639d44a84d /merge-recursive.c
parent6ef2cb008f132e4649ef925a8e1950d3138054d5 (diff)
merge-recursive: Move delete/modify handling into dedicated function
This move is in preparation for the function being called from multiple places in order to handle D/F conflicts. 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.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index c8ac6aebcb..a8f68cf679 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1118,6 +1118,26 @@ error_return:
return ret;
}
+static void handle_delete_modify(struct merge_options *o,
+ const char *path,
+ unsigned char *a_sha, int a_mode,
+ unsigned char *b_sha, int b_mode)
+{
+ if (!a_sha) {
+ output(o, 1, "CONFLICT (delete/modify): %s deleted in %s "
+ "and modified in %s. Version %s of %s left in tree.",
+ path, o->branch1,
+ o->branch2, o->branch2, path);
+ update_file(o, 0, b_sha, b_mode, path);
+ } else {
+ output(o, 1, "CONFLICT (delete/modify): %s deleted in %s "
+ "and modified in %s. Version %s of %s left in tree.",
+ path, o->branch2,
+ o->branch1, o->branch1, path);
+ update_file(o, 0, a_sha, a_mode, path);
+ }
+}
+
/* Per entry merge function */
static int process_entry(struct merge_options *o,
const char *path, struct stage_data *entry)
@@ -1150,19 +1170,8 @@ static int process_entry(struct merge_options *o,
} else {
/* Deleted in one and changed in the other */
clean_merge = 0;
- if (!a_sha) {
- output(o, 1, "CONFLICT (delete/modify): %s deleted in %s "
- "and modified in %s. Version %s of %s left in tree.",
- path, o->branch1,
- o->branch2, o->branch2, path);
- update_file(o, 0, b_sha, b_mode, path);
- } else {
- output(o, 1, "CONFLICT (delete/modify): %s deleted in %s "
- "and modified in %s. Version %s of %s left in tree.",
- path, o->branch2,
- o->branch1, o->branch1, path);
- update_file(o, 0, a_sha, a_mode, path);
- }
+ handle_delete_modify(o, path,
+ a_sha, a_mode, b_sha, b_mode);
}
} else if ((!o_sha && a_sha && !b_sha) ||