git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC] git rev-contains [Was: merge -s ffonly]

From
Uwe Kleine-König <ukleinek@strlen.de>
Date
Oct 8, 2008, 15:41 UTC
Message-ID
<20081008154106.GA18549@strlen.de>
In-Reply-To
<20081008143050.GG3052@riemann.deskinm.fdns.net>
Hello Deskin,
On Wed, Oct 08, 2008 at 10:30:50AM -0400, Deskin Miller wrote:
Show 18 quoted lines
> 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

Previous: Deskin Miller
Message 5 of 5 in “merge -s ffonly”
  1. Shawn O. PearceOct 6, 2008
  2. [RFC] git rev-contains [Was: merge -s ffonly]Uwe Kleine-König, Oct 7, 2008
  3. Andreas EricssonOct 8, 2008
  4. Deskin MillerOct 8, 2008
  5. Uwe Kleine-KönigOct 8, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.