git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Artur Skawina <art.08.09@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Git List <git@vger.kernel.org>
Subject: Re: Determining commit reachability
Date: Mon, 06 Sep 2010 07:04:33 +0200	[thread overview]
Message-ID: <4C847661.3020800@gmail.com> (raw)
In-Reply-To: <20100906031700.GA25012@sigill.intra.peff.net>

On 09/06/10 05:17, Jeff King wrote:
> On Sun, Sep 05, 2010 at 10:34:11PM +0200, Artur Skawina wrote:
> 
>> Given commit C, refs (branches) R, S and T what would be the best way
>> to test whether 'C' is reachable from any of the heads?
>>
>> Checking if `git rev-list -n1 O ^R ^S ^T` produces any output is what
>> i came up with; is there a better (ie faster) solution?
> 
> I think that is about as fast as you will get. You could try something
> with git-merge-base, but it should be about the same speed.
> 
> Note that neither will tell you _which_ head the target was reachable
> from. For that, given the current interface you have to test each head

As i think i'll only need this to prevent leaking (private) commits that
wouldn't be reachable from the (public) heads, just  catching the
unreachable ones should be enough.

$ time git rev-list -n1 v2.6.12 ^v33 ^v35
0m2.333s user   0m0.040s system   0m2.379s elapsed   99.77% CPU
$ time git rev-list -n1 v2.6.36-rc2 ^v33 ^v35
76be97c1fc945db08aae1f1b746012662d643e97
0m0.500s user   0m0.010s system   0m0.514s elapsed   99.13% CPU

A bit expensive, but I guess should it become a problem I could cache
the result and/or blacklist the client.

Thanks,

artur

  reply	other threads:[~2010-09-06  5:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-05 20:34 Determining commit reachability Artur Skawina
2010-09-06  3:17 ` Jeff King
2010-09-06  5:04   ` Artur Skawina [this message]
2010-09-06  6:47 ` Junio C Hamano
2010-09-06 20:45   ` Sverre Rabbelier
2010-09-06 20:53     ` Ævar Arnfjörð Bjarmason
2010-09-06 21:05       ` Sverre Rabbelier
2010-09-06 23:38         ` Junio C Hamano
2010-09-07  5:52           ` [PATCH] Documentation: explain "git branch --with" Jonathan Nieder
2010-09-07 10:51             ` Ævar Arnfjörð Bjarmason
2010-09-09 22:45             ` Junio C Hamano
2010-09-07 13:04           ` Determining commit reachability Nguyen Thai Ngoc Duy
2010-09-07 13:07             ` Nguyen Thai Ngoc Duy

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=4C847661.3020800@gmail.com \
    --to=art.08.09@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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;
as well as URLs for NNTP newsgroup(s).