3 test_description
='git reset in a bare repository'
6 test_expect_success
'setup non-bare' '
14 test_expect_success
'hard reset requires a worktree' '
16 test_must_fail git reset --hard)
19 test_expect_success
'merge reset requires a worktree' '
21 test_must_fail git reset --merge)
24 test_expect_success
'mixed reset is ok' '
25 (cd .git && git reset)
28 test_expect_success
'soft reset is ok' '
29 (cd .git && git reset --soft)
32 test_expect_success
'hard reset works with GIT_WORK_TREE' '
34 GIT_WORK_TREE=$PWD/worktree GIT_DIR=$PWD/.git git reset --hard &&
35 test_cmp file worktree/file
38 test_expect_success
'setup bare' '
39 git clone --bare . bare.git &&
43 test_expect_success
'hard reset is not allowed in bare' '
44 test_must_fail git reset --hard HEAD^
47 test_expect_success
'merge reset is not allowed in bare' '
48 test_must_fail git reset --merge HEAD^
51 test_expect_success
'mixed reset is not allowed in bare' '
52 test_must_fail git reset --mixed HEAD^
55 test_expect_success
'soft reset is allowed in bare' '
56 git reset --soft HEAD^ &&
57 test "`git show --pretty=format:%s | head -n 1`" = "one"