Re: [PATCH] replace: parse revision argument for -d
- From
Jeff King <peff@peff.net>
- Date
- Oct 29, 2012, 06:58 UTC
- Message-ID
- <20121029065836.GC5102@sigill.intra.peff.net>
- In-Reply-To
- <807340e40adb1fc97cd97161fe1fabd292bc79c3.1351258394.git.git@drmicha.warpmail.net>
On Fri, Oct 26, 2012 at 03:33:27PM +0200, Michael J Gruber wrote:
Show 7 quoted lines
> for (p = argv; *p; p++) {
> - if (snprintf(ref, sizeof(ref), "refs/replace/%s", *p)
> + q = *p;
> + if (get_sha1(q, sha1))
> + warning("Failed to resolve '%s' as a valid ref; taking it literally.", q);
> + else
> + q = sha1_to_hex(sha1);Doesn't get_sha1 already handle this for 40-byte sha1s (and for anything else, it would not work anyway)?
-Peff