Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
t3306,t5304: avoid clock skew issues
Browse files Browse the repository at this point in the history
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 <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael J Gruber authored and gitster committed Apr 14, 2011
1 parent fd5858b commit e3b02bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions t/t3306-notes-prune.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ test_expect_success 'setup: create a few commits with notes' '
git add file3 &&
test_tick &&
git commit -m 3rd &&
COMMIT_FILE=.git/objects/5e/e1c35e83ea47cd3cc4f8cbee0568915fbbbd29 &&
test -f $COMMIT_FILE &&
test-chmtime =+0 $COMMIT_FILE &&
git notes add -m "Note #3"
'

Expand Down
3 changes: 2 additions & 1 deletion t/t5304-prune.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ add_blob() {
BLOB=$(echo aleph_0 | git hash-object -w --stdin) &&
BLOB_FILE=.git/objects/$(echo $BLOB | sed "s/^../&\//") &&
test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
test -f $BLOB_FILE
test -f $BLOB_FILE &&
test-chmtime =+0 $BLOB_FILE
}

test_expect_success setup '
Expand Down

0 comments on commit e3b02bc

Please sign in to comment.