]>
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 | |
be7bae0d SP |
18 | R=$(git describe "$@") |
19 | S=$? | |
5312ab11 | 20 | test_expect_success "describe $*" ' |
be7bae0d | 21 | test $S = 0 && |
5312ab11 JH |
22 | case "$R" in |
23 | $expect) echo happy ;; | |
24 | *) echo "Oops - $R is not $expect"; | |
25 | false ;; | |
26 | esac | |
27 | ' | |
28 | } | |
29 | ||
30 | test_expect_success setup ' | |
31 | ||
32 | test_tick && | |
5be60078 JH |
33 | echo one >file && git add file && git-commit -m initial && |
34 | one=$(git rev-parse HEAD) && | |
5312ab11 JH |
35 | |
36 | test_tick && | |
5be60078 JH |
37 | echo two >file && git add file && git-commit -m second && |
38 | two=$(git rev-parse HEAD) && | |
5312ab11 JH |
39 | |
40 | test_tick && | |
5be60078 | 41 | echo three >file && git add file && git-commit -m third && |
5312ab11 JH |
42 | |
43 | test_tick && | |
5be60078 | 44 | echo A >file && git add file && git-commit -m A && |
5312ab11 JH |
45 | test_tick && |
46 | git-tag -a -m A A && | |
47 | ||
48 | test_tick && | |
5be60078 | 49 | echo c >file && git add file && git-commit -m c && |
5312ab11 JH |
50 | test_tick && |
51 | git-tag c && | |
52 | ||
53 | git reset --hard $two && | |
54 | test_tick && | |
5be60078 | 55 | echo B >side && git add side && git-commit -m B && |
5312ab11 JH |
56 | test_tick && |
57 | git-tag -a -m B B && | |
58 | ||
59 | test_tick && | |
60 | git-merge -m Merged c && | |
5be60078 | 61 | merged=$(git rev-parse HEAD) && |
5312ab11 JH |
62 | |
63 | git reset --hard $two && | |
64 | test_tick && | |
5be60078 | 65 | echo D >another && git add another && git-commit -m D && |
5312ab11 JH |
66 | test_tick && |
67 | git-tag -a -m D D && | |
68 | ||
69 | test_tick && | |
70 | echo DD >another && git commit -a -m another && | |
71 | ||
72 | test_tick && | |
73 | git-tag e && | |
74 | ||
75 | test_tick && | |
76 | echo DDD >another && git commit -a -m "yet another" && | |
77 | ||
78 | test_tick && | |
79 | git-merge -m Merged $merged && | |
80 | ||
81 | test_tick && | |
5be60078 | 82 | echo X >file && echo X >side && git add file side && |
5312ab11 JH |
83 | git-commit -m x |
84 | ||
85 | ' | |
86 | ||
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^ | |
92 | ||
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^ | |
98 | ||
518120e3 SB |
99 | check_describe B-0-* --long HEAD^^2^ |
100 | ||
5312ab11 | 101 | test_done |