summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-02-15 14:55:40 -0800
committerJunio C Hamano <gitster@pobox.com>2018-02-15 14:55:40 -0800
commitae0d0795d736467202d9bfd535942be81529f84e (patch)
treec1745c4d7ff506d62e8f4f3d45180937776f5c82 /merge-recursive.c
parentcc7655a5a3465ccce2c84379721dd1cbdd57faa9 (diff)
parent379fc3786611f677b76400f6f7d0ed0faf2a9739 (diff)
downloadgit-ae0d0795d736467202d9bfd535942be81529f84e.tar.gz
Merge branch 'en/merge-recursive-fixes'
* en/merge-recursive-fixes: merge-recursive: add explanation for src_entry and dst_entry merge-recursive: fix logic ordering issue Tighten and correct a few testcases for merging and cherry-picking
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index cc5fa0a949..9d53f30111 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -513,6 +513,25 @@ static void record_df_conflict_files(struct merge_options *o,
struct rename {
struct diff_filepair *pair;
+ /*
+ * Purpose of src_entry and dst_entry:
+ *
+ * If 'before' is renamed to 'after' then src_entry will contain
+ * the versions of 'before' from the merge_base, HEAD, and MERGE in
+ * stages 1, 2, and 3; dst_entry will contain the respective
+ * versions of 'after' in corresponding locations. Thus, we have a
+ * total of six modes and oids, though some will be null. (Stage 0
+ * is ignored; we're interested in handling conflicts.)
+ *
+ * Since we don't turn on break-rewrites by default, neither
+ * src_entry nor dst_entry can have all three of their stages have
+ * non-null oids, meaning at most four of the six will be non-null.
+ * Also, since this is a rename, both src_entry and dst_entry will
+ * have at least one non-null oid, meaning at least two will be
+ * non-null. Of the six oids, a typical rename will have three be
+ * non-null. Only two implies a rename/delete, and four implies a
+ * rename/add.
+ */
struct stage_data *src_entry;
struct stage_data *dst_entry;
unsigned processed:1;
@@ -1998,10 +2017,10 @@ int merge_trees(struct merge_options *o,
get_files_dirs(o, merge);
entries = get_unmerged();
- record_df_conflict_files(o, entries);
re_head = get_renames(o, head, common, head, merge, entries);
re_merge = get_renames(o, merge, common, head, merge, entries);
clean = process_renames(o, re_head, re_merge);
+ record_df_conflict_files(o, entries);
if (clean < 0)
goto cleanup;
for (i = entries->nr-1; 0 <= i; i--) {