revision.c: stricter parsing of '--early-output'
commitdffc651ed191ff0eb3cfd0e8df83a423b4dae994
authorSZEDER Gábor <szeder.dev@gmail.com>
Fri, 9 Jun 2017 18:17:31 +0000 (9 20:17 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 12 Jun 2017 20:39:46 +0000 (12 13:39 -0700)
tree6a75b5f519418aed944883b558b0cba8f75d58f3
parent9ada7aee198c3644604eac1ff7cc50284b48d85f
revision.c: stricter parsing of '--early-output'

The parsing of '--early-output' with or without its optional integer
argument allowed bogus options like '--early-output-foobarbaz' to slip
through and be ignored.

Fix it by parsing '--early-output' in the same way as other options
with an optional argument are parsed.  Furthermore, use strtoul_ui()
to parse the optional integer argument and to refuse negative numbers.

While at it, use skip_prefix() instead of starts_with() and magic
numbers.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c