Skip to content

Commit eb3e3e1

Browse files
newrengitster
authored andcommitted
merge-ort: collect which directories are removed in dirs_removed
Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f5d9fbc commit eb3e3e1

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

merge-ort.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,27 @@ static void setup_path_info(struct merge_options *opt,
480480
result->util = mi;
481481
}
482482

483+
static void collect_rename_info(struct merge_options *opt,
484+
struct name_entry *names,
485+
const char *dirname,
486+
const char *fullname,
487+
unsigned filemask,
488+
unsigned dirmask,
489+
unsigned match_mask)
490+
{
491+
struct rename_info *renames = &opt->priv->renames;
492+
493+
/* Update dirs_removed, as needed */
494+
if (dirmask == 1 || dirmask == 3 || dirmask == 5) {
495+
/* absent_mask = 0x07 - dirmask; sides = absent_mask/2 */
496+
unsigned sides = (0x07 - dirmask)/2;
497+
if (sides & 1)
498+
strset_add(&renames->dirs_removed[1], fullname);
499+
if (sides & 2)
500+
strset_add(&renames->dirs_removed[2], fullname);
501+
}
502+
}
503+
483504
static int collect_merge_info_callback(int n,
484505
unsigned long mask,
485506
unsigned long dirmask,
@@ -580,6 +601,12 @@ static int collect_merge_info_callback(int n,
580601
return mask;
581602
}
582603

604+
/*
605+
* Gather additional information used in rename detection.
606+
*/
607+
collect_rename_info(opt, names, dirname, fullpath,
608+
filemask, dirmask, match_mask);
609+
583610
/*
584611
* Record information about the path so we can resolve later in
585612
* process_entries.

0 commit comments

Comments
 (0)