git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] merge-recursive: add explanation for src_entry and dst_entry

From
Elijah Newren <newren@gmail.com>
Date
Jan 5, 2018, 20:20 UTC
Message-ID
<20180105202001.24218-4-newren@gmail.com>
In-Reply-To
<20180105202001.24218-1-newren@gmail.com>

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 <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
---
 merge-recursive.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
diff --git a/merge-recursive.c b/merge-recursive.c
index 98c84e73d..d78853d5e 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;
-- 
2.14.2
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 6 of 7 in “Some small fixes to merge-recursive and tests”
  1. 0/3 Some small fixes to merge-recursive and testsElijah Newren, Jan 5, 2018
  2. 1/3 Tighten and correct a few testcases for merging and cherry-pickingElijah Newren, Jan 5, 2018
  3. Johannes SchindelinJan 5, 2018
  4. 2/3 merge-recursive: fix logic ordering issueElijah Newren, Jan 5, 2018
  5. Johannes SchindelinJan 5, 2018
  6. 3/3 merge-recursive: add explanation for src_entry and dst_entryElijah Newren, Jan 5, 2018
  7. Johannes SchindelinJan 5, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.