Re: [PATCH 0/2] finding the fork point from reflog entries
- From
John Keeping <john@keeping.me.uk>
- Date
- Oct 24, 2013, 20:54 UTC
- Message-ID
- <20131024205434.GC10779@serenity.lan>
- In-Reply-To
- <1382641884-14756-1-git-send-email-gitster@pobox.com>
On Thu, Oct 24, 2013 at 12:11:22PM -0700, Junio C Hamano wrote:
Show 8 quoted lines
> The first one is a clean-up of the code to parse command line > options to "git merge-base". Options such as "--independent", > "--is-ancestor" and "--octopus" are mutually exclusive and it is > better expressed in terms of the recently introduced OPT_CMDMODE. > > The second one implements the entire logic of the for loop we see in > "git pull --rebase" directly using get_merge_bases_many() and > postprocessing the result.
Nice! I tried this in the case where the target commit happens to be the 63rd reflog entry:
$ time sh -c 'for rev in $(git rev-list -g origin/master 2>/dev/null)
do
git merge-base --is-ancestor $rev b2edae0 && break
done
'real 0m3.772s user 0m3.338s sys 0m0.440s
$ time git merge-base --reflog origin/master b2edae0
real 0m0.156s user 0m0.138s sys 0m0.018s
Show 7 quoted lines
> Junio C Hamano (2): > merge-base: use OPT_CMDMODE and clarify the command line parsing > merge-base: "--reflog" mode finds fork point from reflog entries > > builtin/merge-base.c | 115 +++++++++++++++++++++++++++++++++++++++++++------- > t/t6010-merge-base.sh | 27 ++++++++++++ > 2 files changed, 126 insertions(+), 16 deletions(-)
Should there be a change to Documentation/git-merge-base.txt in here?