]>
Commit | Line | Data |
---|---|---|
5312ab11 JH |
1 | #!/bin/sh |
2 | ||
3 | test_description='test describe | |
4 | ||
5 | B | |
6 | .--------------o----o----o----x | |
7 | / / / | |
8 | o----o----o----o----o----. / | |
9 | \ A c / | |
10 | .------------o---o---o | |
11 | D e | |
12 | ' | |
13 | . ./test-lib.sh | |
14 | ||
15 | check_describe () { | |
16 | expect="$1" | |
17 | shift | |
18 | R=$(git describe "$@") && | |
19 | test_expect_success "describe $*" ' | |
20 | case "$R" in | |
21 | $expect) echo happy ;; | |
22 | *) echo "Oops - $R is not $expect"; | |
23 | false ;; | |
24 | esac | |
25 | ' | |
26 | } | |
27 | ||
28 | test_expect_success setup ' | |
29 | ||
30 | test_tick && | |
5be60078 JH |
31 | echo one >file && git add file && git-commit -m initial && |
32 | one=$(git rev-parse HEAD) && | |
5312ab11 JH |
33 | |
34 | test_tick && | |
5be60078 JH |
35 | echo two >file && git add file && git-commit -m second && |
36 | two=$(git rev-parse HEAD) && | |
5312ab11 JH |
37 | |
38 | test_tick && | |
5be60078 | 39 | echo three >file && git add file && git-commit -m third && |
5312ab11 JH |
40 | |
41 | test_tick && | |
5be60078 | 42 | echo A >file && git add file && git-commit -m A && |
5312ab11 JH |
43 | test_tick && |
44 | git-tag -a -m A A && | |
45 | ||
46 | test_tick && | |
5be60078 | 47 | echo c >file && git add file && git-commit -m c && |
5312ab11 JH |
48 | test_tick && |
49 | git-tag c && | |
50 | ||
51 | git reset --hard $two && | |
52 | test_tick && | |
5be60078 | 53 | echo B >side && git add side && git-commit -m B && |
5312ab11 JH |
54 | test_tick && |
55 | git-tag -a -m B B && | |
56 | ||
57 | test_tick && | |
58 | git-merge -m Merged c && | |
5be60078 | 59 | merged=$(git rev-parse HEAD) && |
5312ab11 JH |
60 | |
61 | git reset --hard $two && | |
62 | test_tick && | |
5be60078 | 63 | echo D >another && git add another && git-commit -m D && |
5312ab11 JH |
64 | test_tick && |
65 | git-tag -a -m D D && | |
66 | ||
67 | test_tick && | |
68 | echo DD >another && git commit -a -m another && | |
69 | ||
70 | test_tick && | |
71 | git-tag e && | |
72 | ||
73 | test_tick && | |
74 | echo DDD >another && git commit -a -m "yet another" && | |
75 | ||
76 | test_tick && | |
77 | git-merge -m Merged $merged && | |
78 | ||
79 | test_tick && | |
5be60078 | 80 | echo X >file && echo X >side && git add file side && |
5312ab11 JH |
81 | git-commit -m x |
82 | ||
83 | ' | |
84 | ||
85 | check_describe A-* HEAD | |
86 | check_describe A-* HEAD^ | |
87 | check_describe D-* HEAD^^ | |
88 | check_describe A-* HEAD^^2 | |
89 | check_describe B HEAD^^2^ | |
90 | ||
91 | check_describe A-* --tags HEAD | |
92 | check_describe A-* --tags HEAD^ | |
93 | check_describe D-* --tags HEAD^^ | |
94 | check_describe A-* --tags HEAD^^2 | |
95 | check_describe B --tags HEAD^^2^ | |
96 | ||
97 | test_done |