Test for packed tags in git-describe output
[git.git] / t / t6120-describe.sh
blobcc24477668b807bc38ace346094d788ac1080bbc
1 #!/bin/sh
3 test_description='test describe
6 .--------------o----o----o----x
7 / / /
8 o----o----o----o----o----. /
9 \ A c /
10 .------------o---o---o
11 D e
13 . ./test-lib.sh
15 check_describe () {
16 expect="$1"
17 shift
18 R=$(git describe "$@")
19 S=$?
20 test_expect_success "describe $*" '
21 test $S = 0 &&
22 case "$R" in
23 $expect) echo happy ;;
24 *) echo "Oops - $R is not $expect";
25 false ;;
26 esac
30 test_expect_success setup '
32 test_tick &&
33 echo one >file && git add file && git-commit -m initial &&
34 one=$(git rev-parse HEAD) &&
36 test_tick &&
37 echo two >file && git add file && git-commit -m second &&
38 two=$(git rev-parse HEAD) &&
40 test_tick &&
41 echo three >file && git add file && git-commit -m third &&
43 test_tick &&
44 echo A >file && git add file && git-commit -m A &&
45 test_tick &&
46 git-tag -a -m A A &&
48 test_tick &&
49 echo c >file && git add file && git-commit -m c &&
50 test_tick &&
51 git-tag c &&
53 git reset --hard $two &&
54 test_tick &&
55 echo B >side && git add side && git-commit -m B &&
56 test_tick &&
57 git-tag -a -m B B &&
59 test_tick &&
60 git-merge -m Merged c &&
61 merged=$(git rev-parse HEAD) &&
63 git reset --hard $two &&
64 test_tick &&
65 echo D >another && git add another && git-commit -m D &&
66 test_tick &&
67 git-tag -a -m D D &&
69 test_tick &&
70 echo DD >another && git commit -a -m another &&
72 test_tick &&
73 git-tag e &&
75 test_tick &&
76 echo DDD >another && git commit -a -m "yet another" &&
78 test_tick &&
79 git-merge -m Merged $merged &&
81 test_tick &&
82 echo X >file && echo X >side && git add file side &&
83 git-commit -m x
87 check_describe A-* HEAD
88 check_describe A-* HEAD^
89 check_describe D-* HEAD^^
90 check_describe A-* HEAD^^2
91 check_describe B HEAD^^2^
93 check_describe A-* --tags HEAD
94 check_describe A-* --tags HEAD^
95 check_describe D-* --tags HEAD^^
96 check_describe A-* --tags HEAD^^2
97 check_describe B --tags HEAD^^2^
99 check_describe B-0-* --long HEAD^^2^
101 test_expect_success 'pack tag refs' 'git pack-refs'
102 check_describe A-* HEAD
104 test_done