All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Martin Jansa <martin.jansa@gmail.com>
Cc: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: Re: [PATCH] git: Use merge-base instead of log for testing if a commit is present
Date: Mon, 18 Nov 2013 21:36:47 +0000	[thread overview]
Message-ID: <1384810607.6460.274.camel@ted> (raw)
In-Reply-To: <20131118183213.GI3727@jama>

On Mon, 2013-11-18 at 19:32 +0100, Martin Jansa wrote:
> On Mon, Nov 18, 2013 at 05:17:16PM +0000, Richard Purdie wrote:
> > The current use of git log to check if a given revision is present can be
> > a little fragile.
> > 
> > For example if revision X was on branch A, and then later added to branch
> > B, the update checks would not notice this since they just check for X
> > being in the repository.
> > 
> > We also had some autobuilder corruption where an older packed-refs file
> > was copied over a new repository containing newer pack files. There
> > was no update to the refs file since the revision was present but
> > not accessible in any branch.
> > 
> > The correct fix is to check that the required revisions are present
> > on the specific branches. This patch does this using merge-base.
> 
> I guess that merge-base is probably faster or easier to use, but did you
> consider using git branch --contains?
> 
> e.g. checking if selected branch is in
> git branch --contains ud.revisions[name]
> 
> I'm asking only because I'm using "git branch --contains" in some
> scripts and maybe there is good reason I should rewrite them to use git
> merge-base instead.

git branch --contains gives you a branch list back which you'd have to
then parse to see if branch X was listed. git merge-base is faster and
we can directly ask what we need with an exit code. There is no more
deeply technical reason than that, was just neater.

Cheers,

Richard







      reply	other threads:[~2013-11-18 21:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-18 17:17 [PATCH] git: Use merge-base instead of log for testing if a commit is present Richard Purdie
2013-11-18 18:32 ` Martin Jansa
2013-11-18 21:36   ` Richard Purdie [this message]

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=1384810607.6460.274.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=martin.jansa@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.