mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <>
To: Sam Vilain <>
Subject: Re: [wishlist] git branch -d -r remotename
Date: Sun, 18 Mar 2007 23:40:19 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <> (Junio C. Hamano's message of "Sun, 18 Mar 2007 23:18:34 -0700")

Junio C Hamano <> writes:

> The standard way to check if commit A is included in (i.e. is an
> ancestor of) commit B, without traversing the ancestry chain of
> B all the way down to the root commit, is to run:
> 	git merge-base --all A B
> and see if A appears in its output (if so, then A is an ancestor
> of B, otherwise it is not).  This is a pair-wise check, and for
> your purpose the check would become N*M operation (Yuck).
> The same check can be done in parallel with:
> 	git show-branch --independent A B C D...
> whose output would include A if the commit is not included in
> any of the other commits B C D...  This parallel traversal has a
> limit --- you can only check 25 branches at a time.

Well, I was silly.  If you want to see if A is an ancestor of
any of B C D..., the standard and most efficient way to do so is
with rev-list.

	git rev-list A --not B C D...

will show _nothing_ only when A is an ancestor of one (or more)
of B C D..., so you invoke it and upon getting the first line of
output you declare A cannot be removed without reading the
remainder of the output.

show-branch --independent is an overkill for your purpose as it
does not treat A any more special from others (iow, it checks if
B is contained in A C D..., C is contained in A B D... all in
parallel), and you are not interested in finding out how remote
refs are related with each other.

  reply	other threads:[~2007-03-19  6:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-18  9:36 [wishlist] git branch -d -r remotename Sam Vilain
2007-03-18 11:01 ` Sam Vilain
2007-03-18 11:01   ` Sam Vilain
2007-03-18 19:42     ` Junio C Hamano
2007-03-18 21:46       ` Sam Vilain
2007-03-19  6:18         ` Junio C Hamano
2007-03-19  6:40           ` Junio C Hamano [this message]
2007-03-19 23:37             ` (unknown) Sam Vilain

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:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* 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.
Code repositories for project(s) associated with this public inbox

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 read-only IMAP folder(s) and NNTP newsgroup(s).