From: Jeff King Date: Wed, 28 Nov 2007 23:03:55 GMT Subject: Re: [PATCH v3] Allow update hooks to update refs on their own Message-ID: <20071128230355.GB13964@coredump.intra.peff.net> In-Reply-To: <20071128221403.GA3256@midwinter.com> On Wed, Nov 28, 2007 at 02:14:03PM -0800, Steven Grimm wrote: > @@ -177,7 +179,16 @@ static int receive_status(int in, struct ref *refs) > > line[strlen(line)-1] = '\0'; > refname = line + 3; > - msg = strchr(refname, ' '); > + newsha1_hex = strchr(refname, ' '); > + if (newsha1_hex) { > + *newsha1_hex++ = '\0'; > + if (get_sha1_hex(newsha1_hex, newsha1)) { > + fprintf(stderr, "protocol error: bad sha1 %s\n", > + newsha1_hex); > + newsha1_hex = NULL; > + } > + } > + msg = strchr(newsha1_hex, ' '); > if (msg) > *msg++ = '\0'; Doesn't this always put the first "word" of a response into newsha1_hex? We want to do this only for 'ok' responses; 'ng' responses are already using that space as part of the error message. -Peff