Skip to content
  • Jeff King's avatar
    replace: refactor command-mode determination · 3f495f67
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    The git-replace command has three modes: listing, deleting,
    and replacing. The first two are selected explicitly. If
    none is selected, we fallback to listing when there are no
    arguments, and replacing otherwise.
    
    Let's figure out up front which operation we are going to
    do, before getting into the application logic. That lets us
    simplify our option checks (e.g., we currently have to check
    whether a useless "--force" is given both along with an
    explicit list, as well as with an implicit one).
    
    This saves some lines, makes the logic easier to follow, and
    will facilitate further cleanups.
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarChristian Couder <chriscool@tuxfamily.org>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    3f495f67