@matheusbsbs / matheus-bagliano / commits / 919a3c9813
Fork 0

Add pack-refs and show-ref test cases.

Some of these test cases are from Junio. One test case is commented out because it doesn't work right now. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Christian Couder committed Sep 28, 2006 at 06:58 UTC 919a3c981323b6f919747bf6756aa8f5af09361f
1 file changed +70
t/t3210-pack-refs.sh new
+70
@@ -0,0 +1,70 @@
1 +#!/bin/sh
2 +#
3 +# Copyright (c) 2005 Amos Waterland
4 +# Copyright (c) 2006 Christian Couder
5 +#
6 +
7 +test_description='git pack-refs should not change the branch semantic
8 +
9 +This test runs git pack-refs and git show-ref and checks that the branch
10 +semantic is still the same.
11 +'
12 +. ./test-lib.sh
13 +
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)'
20 +
21 +SHA1=
22 +
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'
30 +
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'
39 +
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'
46 +
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'
54 +
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'
60 +
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'
69 +
70 +test_done