diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-09 13:34:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-09 13:34:27 +0000 |
commit | 4dbdc42d9e7c3968ff7f690d00680419c9b8cb0f (patch) | |
tree | 47c1d492e9c956c1cd2b74dbd3b9d8b0db44dc4e /t/t7106-reset-unborn-branch.sh | |
parent | Initial commit. (diff) | |
download | git-4dbdc42d9e7c3968ff7f690d00680419c9b8cb0f.tar.xz git-4dbdc42d9e7c3968ff7f690d00680419c9b8cb0f.zip |
Adding upstream version 1:2.43.0.upstream/1%2.43.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/t7106-reset-unborn-branch.sh')
-rwxr-xr-x | t/t7106-reset-unborn-branch.sh | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/t/t7106-reset-unborn-branch.sh b/t/t7106-reset-unborn-branch.sh new file mode 100755 index 0000000..d20e570 --- /dev/null +++ b/t/t7106-reset-unborn-branch.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +test_description='git reset should work on unborn branch' + +TEST_PASSES_SANITIZE_LEAK=true +. ./test-lib.sh + +test_expect_success 'setup' ' + echo a >a && + echo b >b +' + +test_expect_success 'reset' ' + git add a b && + git reset && + + git ls-files >actual && + test_must_be_empty actual +' + +test_expect_success 'reset HEAD' ' + rm .git/index && + git add a b && + test_must_fail git reset HEAD +' + +test_expect_success 'reset $file' ' + rm .git/index && + git add a b && + git reset a && + + echo b >expect && + git ls-files >actual && + test_cmp expect actual +' + +test_expect_success PERL 'reset -p' ' + rm .git/index && + git add a && + echo y >yes && + git reset -p <yes >output && + + git ls-files >actual && + test_must_be_empty actual && + test_grep "Unstage" output +' + +test_expect_success 'reset --soft is a no-op' ' + rm .git/index && + git add a && + git reset --soft && + + echo a >expect && + git ls-files >actual && + test_cmp expect actual +' + +test_expect_success 'reset --hard' ' + rm .git/index && + git add a && + test_when_finished "echo a >a" && + git reset --hard && + + git ls-files >actual && + test_must_be_empty actual && + test_path_is_missing a +' + +test_done |