commit: skip discarding the index if there is no pre-commit hook
authorKevin Willford <kewillf@microsoft.com>
Mon, 14 Aug 2017 21:54:25 +0000 (15:54 -0600)
committerJunio C Hamano <gitster@pobox.com>
Wed, 16 Aug 2017 17:19:46 +0000 (10:19 -0700)
commit680ee550d72150f27cdb3235462eee355a20038b
treee0147e0d7e7208cca1008efbdc85471989c7e1f0
parent3d9c5b5c4461957fbbc0479e037990db04ebb740
commit: skip discarding the index if there is no pre-commit hook

If there is not a pre-commit hook, there is no reason to discard
the index and reread it.

This change checks to presence of a pre-commit hook and then only
discards the index if there was one.

Signed-off-by: Kevin Willford <kewillf@microsoft.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/commit.c