From: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
To: "Santi Béjar" <santi@agolina.net>
Cc: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>,
Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Thomas Rast <trast@student.ethz.ch>
Subject: Re: [PATCH] rebase: be cleverer with rebased upstream branches
Date: Wed, 16 Feb 2011 11:45:49 -0500 (EST) [thread overview]
Message-ID: <alpine.DEB.2.00.1102161122350.14950@debian> (raw)
In-Reply-To: <AANLkTinmxbYLB-K+VzY50NtOAPwd-q3WwAosAHqKRq_0@mail.gmail.com>
On Wed, 16 Feb 2011, Santi B?jar wrote:
> On Wed, Feb 16, 2011 at 3:03 AM, Martin von Zweigbergk
> <martin.von.zweigbergk@gmail.com> wrote:
> > On Tue, 15 Feb 2011, Junio C Hamano wrote:
> >
> >> Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> writes:
> >>
> >> > diff --git a/git-rebase.sh b/git-rebase.sh
> >> > index 5abfeac..1bc0c29 100755
> >> > --- a/git-rebase.sh
> >> > +++ b/git-rebase.sh
> >> test -n "$upstream_name" &&
> >> for reflog in $(git rev-list ...)
> >> do
> >> ...
> >> done
> >>
> >> Don't you need to make sure $upstream_name is a branch (or a ref in
> >> general that can have a reflog), or does it not matter because the
> >> "rev-list -g" will die without producing anything and you are discarding
> >> the error message?
> >
> > Exactly as you suspect. Is it too ugly?
>
> I also prefer Junio's version.
I fixed the test + for loop, if that's what you mean by "Junio's
version". Or did you mean "make sure $upstream_name is a branch"? I
could do that as well if you like. I have no preference.
> > .-u@{0}
> > /
> > .---u@{1}
> > /
> > x---y-----u@{2}
> > \
> > .---u@{3}---b
> > \
> > .-u@{4}
> >
> >
> > I have an idea inspired by bisection, Thomas's exponential stride, and
> > what someone (you?) mentioned the other day about virtual merge
> > commits. I haven't tried it out, but let me know what you think. I'll
> > try to explain it using an example only:
> >
> > Exponential stride phase:
> > 1. candidates={ u@{0} }
> > merge-base b $candidates -> y, _not_ in $candidates
> > 2. candidates={ u@{1} u@{2} }
> > merge-base b $candidates -> y, _not_ in $candidates
> > 3. candidates={ u@{3} u@{4} u@{5} u@{6} }
> > merge-base b $candidates -> u@{3}, in $candidates
>
> Doesn't it indicate that u@{3} is the commit we are looking for? I
> haven't found a counterexample...
Yes, of course. Stupid me ;-). Forget about the other half. (I think
that's what I did manually to match the sha1 back to the ref name, but
that is of course complete non-sense to do in the script.)
> If this is true the following patch can implement it for git-pull.sh and
> git-rebase.sh (sorry if it is space damaged):
Thanks! Will have a closer look at it later today. If I understand
correctly, you simply call merge-base with the _entire_ reflog. I
would have thought that would be slow, but it's great if that is fast
enough. The resulting code looks very nice and short. Thanks again.
/Martin
next prev parent reply other threads:[~2011-02-16 16:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-14 13:51 [PATCH] rebase: be cleverer with rebased upstream branches Martin von Zweigbergk
2011-02-15 11:28 ` Santi Béjar
2011-02-16 1:37 ` Martin von Zweigbergk
2011-02-16 9:26 ` Santi Béjar
2011-02-15 20:30 ` Junio C Hamano
2011-02-16 3:03 ` Martin von Zweigbergk
2011-02-16 12:10 ` Santi Béjar
2011-02-16 13:22 ` Santi Béjar
2011-02-16 19:07 ` Junio C Hamano
2011-02-16 21:16 ` Santi Béjar
2011-02-16 16:45 ` Martin von Zweigbergk [this message]
2011-02-17 10:24 ` Santi Béjar
2011-03-12 21:15 ` Martin von Zweigbergk
2011-03-12 23:51 ` Santi Béjar
2011-03-13 1:32 ` Martin von Zweigbergk
2011-03-13 3:14 ` Martin von Zweigbergk
2011-03-13 22:57 ` Junio C Hamano
2011-03-13 23:42 ` Santi Béjar
2011-03-13 23:09 ` Santi Béjar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.00.1102161122350.14950@debian \
--to=martin.von.zweigbergk@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=santi@agolina.net \
--cc=trast@student.ethz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox