Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-05-10 17:19:05 +0300
committerJunio C Hamano <gitster@pobox.com>2021-05-11 06:45:18 +0300
commit8cfe386b78c15eff38388479aa2f9fae00a9cf53 (patch)
treee52b673bb69073d849b54a417835979942b975ae /t/t6120-describe.sh
parent6cf8d96fa28668a62f05be5b276739c03c514581 (diff)
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 5312ab11fbf (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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6120-describe.sh')
-rwxr-xr-xt/t6120-describe.sh58
1 files changed, 13 insertions, 45 deletions
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index e89b6747be..88fddc9142 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -31,64 +31,32 @@ check_describe () {
}
test_expect_success setup '
+ test_commit initial file one &&
+ test_commit second file two &&
+ test_commit third file three &&
+ test_commit --annotate A file A &&
+ test_commit c file c &&
- test_tick &&
- echo one >file && git add file && git commit -m initial &&
- one=$(git rev-parse HEAD) &&
-
- git describe --always HEAD &&
-
- test_tick &&
- echo two >file && git add file && git commit -m second &&
- two=$(git rev-parse HEAD) &&
-
- test_tick &&
- echo three >file && git add file && git commit -m third &&
-
- test_tick &&
- echo A >file && git add file && git commit -m A &&
- test_tick &&
- git tag -a -m A A &&
-
- test_tick &&
- echo c >file && git add file && git commit -m c &&
- test_tick &&
- git tag c &&
-
- git reset --hard $two &&
- test_tick &&
- echo B >side && git add side && git commit -m B &&
- test_tick &&
- git tag -a -m B B &&
+ git reset --hard second &&
+ test_commit --annotate B side B &&
test_tick &&
git merge -m Merged c &&
merged=$(git rev-parse HEAD) &&
- git reset --hard $two &&
- test_tick &&
- echo D >another && git add another && git commit -m D &&
- test_tick &&
- git tag -a -m D D &&
- test_tick &&
- git tag -a -m R R &&
-
- test_tick &&
- echo DD >another && git commit -a -m another &&
+ git reset --hard second &&
+ test_commit --no-tag D another D &&
test_tick &&
- git tag e &&
+ git tag -a -m R R &&
- test_tick &&
- echo DDD >another && git commit -a -m "yet another" &&
+ test_commit e another DD &&
+ test_commit --no-tag "yet another" another DDD &&
test_tick &&
git merge -m Merged $merged &&
- test_tick &&
- echo X >file && echo X >side && git add file side &&
- git commit -m x
-
+ test_commit --no-tag x file
'
check_describe A-* HEAD