Re: [PATCH 09/13] Allow helpers to report in "list" command that the ref is unchanged
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Aug 5, 2009, 21:03 UTC
- Message-ID
- <alpine.DEB.1.00.0908052258440.8306@pacific.mpi-cbg.de>
- In-Reply-To
- <alpine.LNX.2.00.0908050056000.2147@iabervon.org>
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.)
Ciao, Dscho