Skip to content

Commit 8cfe386

Browse files
avargitster
authored andcommitted
describe tests: convert setup to use test_commit
Convert the setup of the describe tests to use test_commit when possible. This makes use of the new --annotate option to test_commit. Some of the setup here could simply be removed since the data being created wasn't important to any of the subsequent tests, so I've done so. E.g. assigning to the "one" variable was always useless, and just checking that we can describe HEAD after the first commit wasn't useful. In the case of the "two" variable we could instead use the tag we just created. See 5312ab1 (Add describe test., 2007-01-13) for the initial version of this code. There's other cases here like redundant "test_tick" invocations, or the simplification of not echoing "X" to a file we're about to tag as "x", now we just use "x" in both cases. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6cf8d96 commit 8cfe386

File tree

1 file changed

+13
-45
lines changed

1 file changed

+13
-45
lines changed

t/t6120-describe.sh

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -31,64 +31,32 @@ check_describe () {
3131
}
3232

3333
test_expect_success setup '
34+
test_commit initial file one &&
35+
test_commit second file two &&
36+
test_commit third file three &&
37+
test_commit --annotate A file A &&
38+
test_commit c file c &&
3439
35-
test_tick &&
36-
echo one >file && git add file && git commit -m initial &&
37-
one=$(git rev-parse HEAD) &&
38-
39-
git describe --always HEAD &&
40-
41-
test_tick &&
42-
echo two >file && git add file && git commit -m second &&
43-
two=$(git rev-parse HEAD) &&
44-
45-
test_tick &&
46-
echo three >file && git add file && git commit -m third &&
47-
48-
test_tick &&
49-
echo A >file && git add file && git commit -m A &&
50-
test_tick &&
51-
git tag -a -m A A &&
52-
53-
test_tick &&
54-
echo c >file && git add file && git commit -m c &&
55-
test_tick &&
56-
git tag c &&
57-
58-
git reset --hard $two &&
59-
test_tick &&
60-
echo B >side && git add side && git commit -m B &&
61-
test_tick &&
62-
git tag -a -m B B &&
40+
git reset --hard second &&
41+
test_commit --annotate B side B &&
6342
6443
test_tick &&
6544
git merge -m Merged c &&
6645
merged=$(git rev-parse HEAD) &&
6746
68-
git reset --hard $two &&
69-
test_tick &&
70-
echo D >another && git add another && git commit -m D &&
71-
test_tick &&
72-
git tag -a -m D D &&
73-
test_tick &&
74-
git tag -a -m R R &&
75-
76-
test_tick &&
77-
echo DD >another && git commit -a -m another &&
47+
git reset --hard second &&
48+
test_commit --no-tag D another D &&
7849
7950
test_tick &&
80-
git tag e &&
51+
git tag -a -m R R &&
8152
82-
test_tick &&
83-
echo DDD >another && git commit -a -m "yet another" &&
53+
test_commit e another DD &&
54+
test_commit --no-tag "yet another" another DDD &&
8455
8556
test_tick &&
8657
git merge -m Merged $merged &&
8758
88-
test_tick &&
89-
echo X >file && echo X >side && git add file side &&
90-
git commit -m x
91-
59+
test_commit --no-tag x file
9260
'
9361

9462
check_describe A-* HEAD

0 commit comments

Comments
 (0)