Uncomment test case: git branch c/d should barf if branch c exists.
[git/trast.git] / t / t3210-pack-refs.sh
blob193fe1fb4024f7caa0b499e2b05f98d73e4acdcb
1 #!/bin/sh
3 # Copyright (c) 2005 Amos Waterland
4 # Copyright (c) 2006 Christian Couder
7 test_description='git pack-refs should not change the branch semantic
9 This test runs git pack-refs and git show-ref and checks that the branch
10 semantic is still the same.
12 . ./test-lib.sh
14 test_expect_success \
15 'prepare a trivial repository' \
16 'echo Hello > A &&
17 git-update-index --add A &&
18 git-commit -m "Initial commit." &&
19 HEAD=$(git-rev-parse --verify HEAD)'
21 SHA1=
23 test_expect_success \
24 'see if git show-ref works as expected' \
25 'git-branch a &&
26 SHA1=$(< .git/refs/heads/a) &&
27 echo "$SHA1 refs/heads/a" >expect &&
28 git-show-ref a >result &&
29 diff expect result'
31 test_expect_success \
32 'see if a branch still exists when packed' \
33 'git-branch b &&
34 git-pack-refs &&
35 rm .git/refs/heads/b &&
36 echo "$SHA1 refs/heads/b" >expect &&
37 git-show-ref b >result &&
38 diff expect result'
40 test_expect_failure \
41 'git branch c/d should barf if branch c exists' \
42 'git-branch c &&
43 git-pack-refs &&
44 rm .git/refs/heads/c &&
45 git-branch c/d'
47 test_expect_success \
48 'see if a branch still exists after git pack-refs --prune' \
49 'git-branch e &&
50 git-pack-refs --prune &&
51 echo "$SHA1 refs/heads/e" >expect &&
52 git-show-ref e >result &&
53 diff expect result'
55 test_expect_failure \
56 'see if git pack-refs --prune remove ref files' \
57 'git-branch f &&
58 git-pack-refs --prune &&
59 ls .git/refs/heads/f'
61 test_expect_success \
62 'git branch g should work when git branch g/h has been deleted' \
63 'git-branch g/h &&
64 git-pack-refs --prune &&
65 git-branch -d g/h &&
66 git-branch g &&
67 git-pack-refs &&
68 git-branch -d g'
70 test_done