Hi Junio / Elijah, On Thu, Jul 21, 2022 at 09:31:44AM -0700, Junio C Hamano wrote: > "Elijah Newren via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > > > diff --git a/builtin/merge.c b/builtin/merge.c > > index f807bf335bd..11bb4bab0a1 100644 > > --- a/builtin/merge.c > > +++ b/builtin/merge.c > > @@ -1686,12 +1686,12 @@ int cmd_merge(int argc, const char **argv, const char *prefix) > > * tree in the index -- this means that the index must be in > > * sync with the head commit. The strategies are responsible > > * to ensure this. > > + * > > + * Stash away the local changes so that we can try more than one > > + * and/or recover from merge strategies bailing while leaving the > > + * index and working tree polluted. > > */ > > Makes sense. We may want to special-case strategies that are known > not to have the buggy "leave contaminated tree when bailing out" > behaviour to avoid waste. I expect that more than 99.99% of the > time people are feeding a single other commit to ort or recursive, > and if these are known to be safe, a lot will be saved by not saving > "just in case". But that can be left for later, after the series > solidifies. This may stretch your memory a bit since the above was many months ago, but I'm wondering if you know of any effort since to build the above described optimisations? We've seen when Git 2.38.0 (which introduced this change) is used with Bitbucket Server it results in a severe performance regression due to an sharp increase in disk and CPU load. Our code that tests the mergeability of a pull request is one such affected codepath. If there isn't any existing efforts to build the optimisations you mention above I will have a shot at it. > > - if (use_strategies_nr == 1 || > > - /* > > - * Stash away the local changes so that we can try more than one. > > - */ > > - save_state(&stash)) > > + if (save_state(&stash)) > > oidclr(&stash); > > > > for (i = 0; !merge_was_ok && i < use_strategies_nr; i++) { Best Regards, Ben Humphreys