From: Johan Herland Date: Mon, 16 May 2011 09:53:17 GMT Subject: Re: [PATCHv3 6/9] receive-pack: Prepare for addition of the new 'limit-*' family of capabilities Message-ID: <201105161153.18025.johan@herland.net> In-Reply-To: <7vaaenm957.fsf@alter.siamese.dyndns.org> On Monday 16 May 2011, Junio C Hamano wrote: > Johan Herland writes: > > +const char *server_supports(const char *feature) > > > > { > > > > - return server_capabilities && > > - strstr(server_capabilities, feature) != NULL; > > + if (server_capabilities) > > + return strstr(server_capabilities, feature); > > + return NULL; > > > > } > > I've been meaning to fix this part, but currently the feature set is > given as space separated list " featurea featureb featurec" and we check > with a token without any space around, e.g. "if > (server_supports("no-done"))", which is quite broken. > > We should tighten this strstr() to make sure we are not matching in the > middle of a string, and the need to do so is even greater now that you > are going to introduce "foo=" and the value could even be strings > in the future. > > How about implementing rules like these: > > [...] Agreed. I'll take a stab at this in the re-roll. ...Johan -- Johan Herland, www.herland.net