fsck: do not fallback "git fsck <bogus>" to "git fsck"
commitc3271a0e4715eb9c3f03dde4fdda23f50cc176c3
authorJeff King <peff@peff.net>
Mon, 16 Jan 2017 21:34:21 +0000 (16 16:34 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 17 Jan 2017 22:24:33 +0000 (17 14:24 -0800)
treea0ce101b98a3311f2fa18186f6fcc31476d815b9
parentc6c7b16d23a4cb6af26acee865c2ade1a3822bef
fsck: do not fallback "git fsck <bogus>" to "git fsck"

Since fsck tries to continue as much as it can after seeing
an error, we still do the reachability check even if some
heads we were given on the command-line are bogus. But if
_none_ of the heads is is valid, we fallback to checking all
refs and the index, which is not what the user asked for at
all.

Instead of checking "heads", the number of successful heads
we got, check "argc" (which we know only has non-options in
it, because parse_options removed the others).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fsck.c
t/t1450-fsck.sh