diff options
author | Jeff King <peff@peff.net> | 2013-03-22 20:19:56 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-03-23 01:09:55 +0400 |
commit | 837154978e94586027e9684ecfbdfd4178c1c8aa (patch) | |
tree | 4234d4588503d07021b41c1448d97b0cd2639f07 /bundle.h | |
parent | c9fc4415e2c7d7673cdad34d41114ede3435a395 (diff) |
submodule: clarify logic in show_submodule_summary
There are two uses of the "left" and "right" commit variables that
make it hard to be sure what values they have (both for the reader,
and for gcc, which wrongly complains that they might be used
uninitialized).
The function starts with a cascading if statement, checking that the
input sha1s exist, and finally working up to preparing a revision
walk. We only prepare the walk if the cascading conditional did not
find any problems, which we check by seeing whether it set the
"message" variable or not. It's simpler and more obvious to just add
a condition to the end of the cascade.
Later, we check the same "message" variable when deciding whether to
clear commit marks on the left/right commits; if it is set, we
presumably never started the walk. This is wrong, though; we might
have started the walk and munged commit flags, only to encounter an
error afterwards. We should always clear the flags on left/right if
they exist, whether the walk was successful or not.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'bundle.h')
0 files changed, 0 insertions, 0 deletions