Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t7103-reset-bare.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t7103-reset-bare.sh` 73 lines ยท 1571 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='git reset in a bare repository' 4 5 . ./test-lib.sh 6 7 test_expect_success 'setup non-bare' ' 8 echo one >file && 9 git add file && 10 git commit -m one && 11 echo two >file && 12 git commit -a -m two 13 ' 14 15 test_expect_success '"hard" reset requires a worktree' ' 16 (cd .git && 17 test_must_fail git reset --hard) 18 ' 19 20 test_expect_success '"merge" reset requires a worktree' ' 21 (cd .git && 22 test_must_fail git reset --merge) 23 ' 24 25 test_expect_success '"keep" reset requires a worktree' ' 26 (cd .git && 27 test_must_fail git reset --keep) 28 ' 29 30 test_expect_success '"mixed" reset is ok' ' 31 (cd .git && git reset) 32 ' 33 34 test_expect_success '"soft" reset is ok' ' 35 (cd .git && git reset --soft) 36 ' 37 38 test_expect_success 'hard reset works with GIT_WORK_TREE' ' 39 mkdir worktree && 40 GIT_WORK_TREE=$PWD/worktree GIT_DIR=$PWD/.git git reset --hard && 41 test_cmp file worktree/file 42 ' 43 44 test_expect_success 'setup bare' ' 45 git clone --bare . bare.git && 46 cd bare.git 47 ' 48 49 test_expect_success '"hard" reset is not allowed in bare' ' 50 test_must_fail git reset --hard HEAD^ 51 ' 52 53 test_expect_success '"merge" reset is not allowed in bare' ' 54 test_must_fail git reset --merge HEAD^ 55 ' 56 57 test_expect_success '"keep" reset is not allowed in bare' ' 58 test_must_fail git reset --keep HEAD^ 59 ' 60 61 test_expect_success '"mixed" reset is not allowed in bare' ' 62 test_must_fail git reset --mixed HEAD^ 63 ' 64 65 test_expect_success '"soft" reset is allowed in bare' ' 66 git reset --soft HEAD^ && 67 git show --pretty=format:%s >out && 68 echo one >expect && 69 head -n 1 out >actual && 70 test_cmp expect actual 71 ' 72 73 test_done