Skip to content

Commit f421e02

Browse files
peffgitster
authored andcommitted
t6000: use test_tick consistently
The first two commits created in t6000 are done without test_tick, meaning they use the current system clock. After that, we create one with test_tick, which means it uses a deterministic time in the past. The result of the "symleft flag bit is propagated down from tag" test relies on the output order of commits from git-log, which in turn depends on these timestamps. So this test is technically dependent on the system clock time, though in practice it would only matter if your system clock was set before test_tick's default time (which is in 2005). However, let's use test_tick consistently for those early commits (and update the expected output to match). This makes the test deterministic, which is in turn easier to reason about and debug. Note that there's also a fourth commit here, and it does not use test_tick. It does have a deterministic timestamp because of the prior use of test_tick in the script, but it will always be the same time as the third commit. Let's use test_tick here, too, for consistency. The matching timestamps between the third and fourth commit are not an important part of the test. We could also use test_commit in all of these cases, as it runs test_tick under the hood. But it would be awkward to do so, as these tests diverge from the usual test_commit patterns (e.g., by creating multiple files in a single commit). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent af6b65d commit f421e02

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

t/t6000-rev-list-misc.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ test_expect_success setup '
88
echo content1 >wanted_file &&
99
echo content2 >unwanted_file &&
1010
git add wanted_file unwanted_file &&
11+
test_tick &&
1112
git commit -m one
1213
'
1314

@@ -21,6 +22,7 @@ test_expect_success 'rev-list --objects with pathspecs and deeper paths' '
2122
mkdir foo &&
2223
>foo/file &&
2324
git add foo/file &&
25+
test_tick &&
2426
git commit -m two &&
2527
2628
git rev-list --objects HEAD -- foo >output &&
@@ -69,6 +71,7 @@ test_expect_success '--no-object-names and --object-names are last-one-wins' '
6971
'
7072

7173
test_expect_success 'rev-list A..B and rev-list ^A B are the same' '
74+
test_tick &&
7275
git commit --allow-empty -m another &&
7376
git tag -a -m "annotated" v1.0 &&
7477
git rev-list --objects ^v1.0^ v1.0 >expect &&
@@ -84,10 +87,10 @@ test_expect_success 'propagate uninteresting flag down correctly' '
8487
test_expect_success 'symleft flag bit is propagated down from tag' '
8588
git log --format="%m %s" --left-right v1.0...master >actual &&
8689
cat >expect <<-\EOF &&
87-
> two
88-
> one
8990
< another
9091
< that
92+
> two
93+
> one
9194
EOF
9295
test_cmp expect actual
9396
'

0 commit comments

Comments
 (0)