Re: [PATCH 09/13] Allow helpers to report in "list" command that the ref is unchanged

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

 



On Wed, 5 Aug 2009, Johannes Schindelin wrote:

> Hi,
> 
> On Wed, 5 Aug 2009, Daniel Barkalow wrote:
> 
> > +			if (strstr(eon + 1, "unchanged")) {
> 
> I guess we'll want to have a helper like this already:
> 
> 	static int has_attribute(const char *tail, const char *attr) {
> 		int len;
> 
> 		if (!tail)
> 			return 0;
> 
> 		len = strlen(attr);
> 		for (;;) {
> 			const char *space = strchrnul(tail, ' ');
> 			if (len == space - tail && !strncmp(tail, attr, len))
> 				return 1;
> 			if (!*space)
> 				return 0;
> 			tail = space + 1;
> 		}
> 	}
> 
> This guards against attributes that are substrings of other attributes.  
> (You want to future-proof the attributes system, after all, i.e. handle 
> helpers returning attributes unknown to the current Git.)

Good point.

	-Daniel
*This .sig left intentionally blank*
--
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]