rev-parse: add helper for parsing "--foo/--foo="
authorJeff King <peff@peff.net>
Wed, 15 Mar 2017 20:06:53 +0000 (16:06 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Mar 2017 21:01:51 +0000 (14:01 -0700)
We can't just use a bare skip_prefix() for these cases,
because we need to match both the "--foo" form and the
"--foo=<value>" form (and tell the difference between the
two in the caller).

We can wrap this in a simple helper which has two obvious
callsites, and will gain some more in the next patch.

Note that the error output for abbrev-ref changes slightly,
as we don't keep our original "arg" pointer. However, the
new output should hopefully be more clear:

[before]
fatal: unknown mode for --abbrev-ref=foo

[after]
fatal: unknown mode for --abbrev-ref: foo

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
No differences found