• Jeff King's avatar
    reset: pass real rev name to add--interactive · b3e9ce13
    Jeff King authored
    The add--interactive --patch mode adjusts the UI based on
    whether we are pulling changes from HEAD or elsewhere (in
    the former case it asks to unstage the reverse hunk, rather
    than apply the forward hunk).
    Commit 166ec2e9 taught reset to work on an unborn branch, but
    in doing so, switched to always providing add--interactive
    with the sha1 rather than the symbolic name. This meant we
    always used the "apply" interface, even for "git reset -p
    We can fix this by passing the symbolic name to
    add--interactive.  Since it understands unborn branches
    these days, we do not even have to cover this special case
    ourselves; we can simply pass HEAD.
    The tests in t7105 now check that the right interface is
    used in each circumstance (and notice the regression from
    166ec2e9 we are fixing). The test in t7106 checks that we
    get this right for the unborn case, too (not a regression,
    since it didn't work at all before, but a nice improvement).
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
t7105-reset-patch.sh 1.82 KB