summaryrefslogtreecommitdiff
path: root/merge-ort.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2021-01-07 21:35:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-01-07 23:30:03 (GMT)
commiteb3e3e1ddffa1348532a6b8d741c235e4c73017c (patch)
tree2270cc00e8e8cc15971e8f220a9691b3d30a624b /merge-ort.c
parentf5d9fbc2e9fde9a9dc08de12ad5ed0c6d7e3fb0a (diff)
downloadgit-eb3e3e1ddffa1348532a6b8d741c235e4c73017c.zip
git-eb3e3e1ddffa1348532a6b8d741c235e4c73017c.tar.gz
git-eb3e3e1ddffa1348532a6b8d741c235e4c73017c.tar.bz2
merge-ort: collect which directories are removed in dirs_removed
Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-ort.c')
-rw-r--r--merge-ort.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/merge-ort.c b/merge-ort.c
index 2e6d41b..999a7c9 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -480,6 +480,27 @@ static void setup_path_info(struct merge_options *opt,
result->util = mi;
}
+static void collect_rename_info(struct merge_options *opt,
+ struct name_entry *names,
+ const char *dirname,
+ const char *fullname,
+ unsigned filemask,
+ unsigned dirmask,
+ unsigned match_mask)
+{
+ struct rename_info *renames = &opt->priv->renames;
+
+ /* Update dirs_removed, as needed */
+ if (dirmask == 1 || dirmask == 3 || dirmask == 5) {
+ /* absent_mask = 0x07 - dirmask; sides = absent_mask/2 */
+ unsigned sides = (0x07 - dirmask)/2;
+ if (sides & 1)
+ strset_add(&renames->dirs_removed[1], fullname);
+ if (sides & 2)
+ strset_add(&renames->dirs_removed[2], fullname);
+ }
+}
+
static int collect_merge_info_callback(int n,
unsigned long mask,
unsigned long dirmask,
@@ -581,6 +602,12 @@ static int collect_merge_info_callback(int n,
}
/*
+ * Gather additional information used in rename detection.
+ */
+ collect_rename_info(opt, names, dirname, fullpath,
+ filemask, dirmask, match_mask);
+
+ /*
* Record information about the path so we can resolve later in
* process_entries.
*/