• Jeff King's avatar
    submodule: clarify logic in show_submodule_summary · 83715497
    Jeff King authored
    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
    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: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
submodule.c 27.6 KB