Elijah Newren <newren@xxxxxxxxx> writes: > I know this bug doesn't satisfy the normal criteria for making it into > 2.23 (it's a bug that was present in 2.22 rather than a regression in > 2.23), but given that it's a BUG() condition, I was hoping it is > important and safe enough to include anyway. For maintenance and upcoming release, a safer "fix" to do might be to also (in addition to this patch) flip the default to no to revert to the stable state before "directory renames" was introduced, while still allowing those who want to help can explore the right fix to this codepath. > (This fix does merge down cleanly to master, next, and pu.) > > merge-recursive.c | 3 +- > t/t6043-merge-rename-directories.sh | 111 ++++++++++++++++++++++++++++ > 2 files changed, 113 insertions(+), 1 deletion(-) > > diff --git a/merge-recursive.c b/merge-recursive.c > index d2e380b7ed..c7691d9b54 100644 > --- a/merge-recursive.c > +++ b/merge-recursive.c > @@ -2856,7 +2856,8 @@ static int detect_and_process_renames(struct merge_options *opt, > head_pairs = get_diffpairs(opt, common, head); > merge_pairs = get_diffpairs(opt, common, merge); > > - if (opt->detect_directory_renames) { > + if ((opt->detect_directory_renames == 2) || > + (opt->detect_directory_renames == 1 && !opt->call_depth)) {