summaryrefslogtreecommitdiff
path: root/t/t7106-reset-unborn-branch.sh
AgeCommit message (Collapse)AuthorFilesLines
2013-10-25reset: pass real rev name to add--interactiveLibravatar Jeff King1-2/+3
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 166ec2e 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 HEAD". 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 166ec2e 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: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-24reset test: modernize styleLibravatar Jonathan Nieder1-7/+24
Avoid command substitution and pipes to ensure that the exit status from each git command is tested (and in particular that any segfaults are caught). Maintain the test setup (no commits, one file named "a", another named "b") even after the last test, to make it easier to rearrange tests or add new tests after the last in the future. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-24t/t7106-reset-unborn-branch.sh: Add PERL prerequisiteLibravatar Kacper Kornet1-1/+1
The test 'reset -p' uses git-reset -p, so it depends on the perl code. Signed-off-by: Kacper Kornet <draenog@pld-linux.org> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-15reset: allow reset on unborn branchLibravatar Martin von Zweigbergk1-0/+52
Some users seem to think, knowingly or not, that being on an unborn branch is like having a commit with an empty tree checked out, but when run on an unborn branch, "git reset" currently fails with: fatal: Failed to resolve 'HEAD' as a valid ref. Instead of making users figure out that they should run git rm --cached -r . , let's teach "git reset" without a revision argument, when on an unborn branch, to behave as if the user asked to reset to an empty tree. Don't take the analogy with an empty commit too far, though, but still disallow explictly referring to HEAD in "git reset HEAD". Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>