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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.  And --max-count means your command line
won't overflow.

Or what about this:

if test "$(git merge-base $1 HEAD)" = "$(git rev-parse $1)"

My $0.02,
Deskin Miller

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux