diff mbox series

[v4,4/4] merge-ort: miscellaneous touch-ups

Message ID 6de569e6ac492213e81321ca35f1f1b365ba31e3.1623168703.git.gitgitgadget@gmail.com (mailing list archive)
State Accepted
Commit ef68c3d800b9c4516f1a13038e047610882cd26f
Headers show
Series Optimization batch 12: miscellaneous unthemed stuff | expand

Commit Message

Elijah Newren June 8, 2021, 4:11 p.m. UTC
From: Elijah Newren <newren@gmail.com>

Add some notes in the code about invariants with match_mask when adding
pairs.  Also add a comment that seems to have been left out in my work
of pushing these changes upstream.

Signed-off-by: Elijah Newren <newren@gmail.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
---
 merge-ort.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/merge-ort.c b/merge-ort.c
index 2ec382e292a6..cfa751053b01 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -765,6 +765,7 @@  static void add_pair(struct merge_options *opt,
 	int names_idx = is_add ? side : 0;
 
 	if (is_add) {
+		assert(match_mask == 0 || match_mask == 6);
 		if (strset_contains(&renames->cached_target_names[side],
 				    pathname))
 			return;
@@ -772,6 +773,8 @@  static void add_pair(struct merge_options *opt,
 		unsigned content_relevant = (match_mask == 0);
 		unsigned location_relevant = (dir_rename_mask == 0x07);
 
+		assert(match_mask == 0 || match_mask == 3 || match_mask == 5);
+
 		/*
 		 * If pathname is found in cached_irrelevant[side] due to
 		 * previous pick but for this commit content is relevant,
@@ -3477,6 +3480,8 @@  static void process_entry(struct merge_options *opt,
 	 */
 	if (!ci->merged.clean)
 		strmap_put(&opt->priv->conflicted, path, ci);
+
+	/* Record metadata for ci->merged in dir_metadata */
 	record_entry_for_tree(dir_metadata, path, &ci->merged);
 }