All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <ukleinek@strlen.de>
To: Deskin Miller <deskinm@umich.edu>
Cc: "Shawn O. Pearce" <spearce@spearce.org>,
	git@vger.kernel.org, "Randal L. Schwartz" <merlyn@stonehenge.com>
Subject: Re: [RFC] git rev-contains [Was: merge -s ffonly]
Date: Wed, 8 Oct 2008 17:41:06 +0200	[thread overview]
Message-ID: <20081008154106.GA18549@strlen.de> (raw)
In-Reply-To: <20081008143050.GG3052@riemann.deskinm.fdns.net>

Hello Deskin,

On Wed, Oct 08, 2008 at 10:30:50AM -0400, Deskin Miller wrote:
> On Tue, Oct 07, 2008 at 08:58:15PM +0200, =?ISO-8859-1?Q?Uwe_Kleine-K=F6nig_ wrote:
> > > +	if test -n "$(git rev-list $1..HEAD)"
> > I already wrote similar tests and I wonder if this couldn't be done in a
> > new builtin command more effectively.  Something like
> > 
> > 	git rev-contains HEAD "$1"
> > 
> > .  I expect it to be faster and maybe it prevents a command line
> > overflow?! [...]
>  
> I'm not sure this warrants a builtin; seems like test is perfectly capable of
> doing what you want:
> 
> if test '(' -n "$(git rev-list --max-count=1 $1..HEAD)" ')' -a \
> 	'(' -z "$(git rev-list --max-count=1 HEAD..$1)" ')'
> 
> The second check is needed to ensure that the commits actually have an
> ancestor-descendant relationship.
This is needed for the original patch, too, isn't it.

>                                    And --max-count means your command line
> won't overflow.
ah, --max-count is a nice idea.  Topgit could benefit from it.
 
> Or what about this:
> 
> if test "$(git merge-base $1 HEAD)" = "$(git rev-parse $1)"

It's not entirely clear to me, this works in general, because a
merge-base isn't unique.  It should work in this case, though.

Best regards
Uwe

      reply	other threads:[~2008-10-08 15:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-06 23:56 merge -s ffonly Shawn O. Pearce
2008-10-07 18:58 ` [RFC] git rev-contains [Was: merge -s ffonly] Uwe Kleine-König
2008-10-08  6:18   ` Andreas Ericsson
2008-10-08 14:30   ` Deskin Miller
2008-10-08 15:41     ` Uwe Kleine-König [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=20081008154106.GA18549@strlen.de \
    --to=ukleinek@strlen.de \
    --cc=deskinm@umich.edu \
    --cc=git@vger.kernel.org \
    --cc=merlyn@stonehenge.com \
    --cc=spearce@spearce.org \
    /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.