From: Junio C Hamano Date: Mon, 02 Jul 2012 23:01:52 GMT Subject: Re: [PATCH v4 14/18] sha1_name.c: many short names can only be committish Message-ID: <7vipe5ydgf.fsf@alter.siamese.dyndns.org> In-Reply-To: <1341268449-27801-15-git-send-email-gitster@pobox.com> Junio C Hamano writes: > diff --git a/sha1_name.c b/sha1_name.c > index 6f6c49c..35ad473 100644 > --- a/sha1_name.c > +++ b/sha1_name.c > @@ -519,6 +539,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1) > unsigned char outer[20]; > const char *sp; > unsigned int expected_type = 0; > + unsigned lookup_flags; This needs to be initialized to 0, i.e. unsigned lookup_flags = 0; for the following two hunks to make sense. > @@ -554,7 +575,10 @@ static int peel_onion(const char *name, int len, unsigned char *sha1) > else > return -1; > > - if (get_sha1_1(name, sp - name - 2, outer, 0)) > + if (expected_type == OBJ_COMMIT) > + lookup_flags = GET_SHA1_COMMITTISH; > + > + if (get_sha1_1(name, sp - name - 2, outer, lookup_flags)) > return -1; > > o = parse_object(outer); > @@ -666,7 +690,7 @@ static int get_sha1_1(const char *name, int len, unsigned char *sha1, unsigned l > if (!ret) > return 0; > > - return get_short_sha1(name, len, sha1, 0); > + return get_short_sha1(name, len, sha1, lookup_flags); > } > > /*