Skip to content

Commit e3b02bc

Browse files
Michael J Grubergitster
authored andcommitted
t3306,t5304: avoid clock skew issues
On systems where the local time and file modification time may be out of sync (e.g. test directory on NFS) t3306 and t5305 can fail because prune compares times such as "now" (client time) with file modification times (server times for remote file systems). I.e., these are spurious test failures. Avoid this by setting the relevant modification times to the local time. Noticed on a system with as little as 2s time skew. Signed-off-by: Michael J Gruber <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fd5858b commit e3b02bc

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

t/t3306-notes-prune.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ test_expect_success 'setup: create a few commits with notes' '
2020
git add file3 &&
2121
test_tick &&
2222
git commit -m 3rd &&
23+
COMMIT_FILE=.git/objects/5e/e1c35e83ea47cd3cc4f8cbee0568915fbbbd29 &&
24+
test -f $COMMIT_FILE &&
25+
test-chmtime =+0 $COMMIT_FILE &&
2326
git notes add -m "Note #3"
2427
'
2528

t/t5304-prune.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ add_blob() {
1414
BLOB=$(echo aleph_0 | git hash-object -w --stdin) &&
1515
BLOB_FILE=.git/objects/$(echo $BLOB | sed "s/^../&\//") &&
1616
test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
17-
test -f $BLOB_FILE
17+
test -f $BLOB_FILE &&
18+
test-chmtime =+0 $BLOB_FILE
1819
}
1920

2021
test_expect_success setup '

0 commit comments

Comments
 (0)