Skip to content

Commit 53ab9f0

Browse files
peffgitster
authored andcommitted
diff-highlight: use test_tick in graph test
The exact ordering output by Git may depend on the commit timestamps, so let's make sure they're actually monotonically increasing, and not all the same (or worse, subject to how long the test script takes to run). Let's use test_tick to make sure this is stable. Note that we actually have to rearrange the order of the branches to match the expected graph structure (which means that previously we might racily have been testing a slightly different output, though the test is written in such a way that we'd still pass). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5013acc commit 53ab9f0

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

contrib/diff-highlight/t/t9400-diff-highlight.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ test_strip_patch_header () {
5252
# dh_test_setup_history generates a contrived graph such that we have at least
5353
# 1 nesting (E) and 2 nestings (F).
5454
#
55-
# A branch
55+
# A master
5656
# /
57-
# D---E---F master
57+
# D---E---F branch
5858
#
5959
# git log --all --graph
6060
# * commit
@@ -74,18 +74,22 @@ dh_test_setup_history () {
7474

7575
cat file1 >file &&
7676
git add file &&
77+
test_tick &&
7778
git commit -m "D" &&
7879

7980
git checkout -b branch &&
8081
cat file2 >file &&
81-
git commit -a -m "A" &&
82-
83-
git checkout master &&
84-
cat file2 >file &&
82+
test_tick &&
8583
git commit -a -m "E" &&
8684

8785
cat file3 >file &&
88-
git commit -a -m "F"
86+
test_tick &&
87+
git commit -a -m "F" &&
88+
89+
git checkout master &&
90+
cat file2 >file &&
91+
test_tick &&
92+
git commit -a -m "A"
8993
}
9094

9195
left_trim () {

0 commit comments

Comments
 (0)