Skip to content

Commit 379fc37

Browse files
newrengitster
authored andcommitted
merge-recursive: add explanation for src_entry and dst_entry
If I have to walk through the debugger and inspect the values found in here in order to figure out their meaning, despite having known these things inside and out some years back, then they probably need a comment for the casual reader to explain their purpose. Reviewed-By: Stefan Beller <[email protected]> Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6c8647d commit 379fc37

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

merge-recursive.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,25 @@ static void record_df_conflict_files(struct merge_options *o,
513513

514514
struct rename {
515515
struct diff_filepair *pair;
516+
/*
517+
* Purpose of src_entry and dst_entry:
518+
*
519+
* If 'before' is renamed to 'after' then src_entry will contain
520+
* the versions of 'before' from the merge_base, HEAD, and MERGE in
521+
* stages 1, 2, and 3; dst_entry will contain the respective
522+
* versions of 'after' in corresponding locations. Thus, we have a
523+
* total of six modes and oids, though some will be null. (Stage 0
524+
* is ignored; we're interested in handling conflicts.)
525+
*
526+
* Since we don't turn on break-rewrites by default, neither
527+
* src_entry nor dst_entry can have all three of their stages have
528+
* non-null oids, meaning at most four of the six will be non-null.
529+
* Also, since this is a rename, both src_entry and dst_entry will
530+
* have at least one non-null oid, meaning at least two will be
531+
* non-null. Of the six oids, a typical rename will have three be
532+
* non-null. Only two implies a rename/delete, and four implies a
533+
* rename/add.
534+
*/
516535
struct stage_data *src_entry;
517536
struct stage_data *dst_entry;
518537
unsigned processed:1;

0 commit comments

Comments
 (0)