Re: [PATCH 09/13] Allow helpers to report in "list" command that the ref is unchanged
On Wed, 5 Aug 2009, Johannes Schindelin wrote:
Show 28 quoted lines
> 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*