{"thread":{"id":"14998","subject":"[PATCH] t5304-prune: adjust file mtime based on system time rather than file mtime","startedAt":"2008-08-14T00:49:30Z","lastAt":"2008-08-14T00:49:30Z","messageCount":1,"participants":["Brandon Casey"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"87132","messageId":"ubiY6pg8BYUJusLOylTtvFzdFYgkEJy7i2m0bW1TMtF04C0_AUVHwQ@cipher.nrlssc.navy.mil","threadId":"14998","inReplyTo":null,"subject":"[PATCH] t5304-prune: adjust file mtime based on system time rather than file mtime","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-08-14T00:49:30Z","receivedAt":"2008-08-14T00:49:30Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"test-chmtime can adjust the mtime of a file based on the file's mtime, or\nbased on the system time. For files accessed over NFS, the file's mtime is\nset by the NFS server, and as such may vary a great deal from the NFS\nclient's system time if the clocks of the client and server are out of\nsync. Since these tests are testing the expire feature of git-prune, an\nincorrect mtime could cause a file to be expired or not expired incorrectly\nand produce a test failure.\n\nAvoid this NFS pitfall by modifying the calls to test-chmtime so that the\nmtime is adjusted based on the system time, rather than the file's mtime.\n\nSigned-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n\n\nThose are a lot of words to say that my system clock is about a minute off\nfrom my NFS server and it caused this test to fail.\n\n>From looking at how precise the second two test-chmtime()'s are, it seems\nlike this change is what was originally intended anyway.\n\n-brandon\n\n\n t/t5304-prune.sh |    8 ++++----\n 1 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t5304-prune.sh b/t/t5304-prune.sh\nindex 9fd9d07..771c0a0 100755\n--- a/t/t5304-prune.sh\n+++ b/t/t5304-prune.sh\n@@ -21,7 +21,7 @@ test_expect_success 'prune stale packs' '\n \torig_pack=$(echo .git/objects/pack/*.pack) &&\n \t: > .git/objects/tmp_1.pack &&\n \t: > .git/objects/tmp_2.pack &&\n-\ttest-chmtime -86501 .git/objects/tmp_1.pack &&\n+\ttest-chmtime =-86501 .git/objects/tmp_1.pack &&\n \tgit prune --expire 1.day &&\n \ttest -f $orig_pack &&\n \ttest -f .git/objects/tmp_2.pack &&\n@@ -39,7 +39,7 @@ test_expect_success 'prune --expire' '\n \tgit prune --expire=1.hour.ago &&\n \ttest $((1 + $before)) = $(git count-objects | sed \"s/ .*//\") &&\n \ttest -f $BLOB_FILE &&\n-\ttest-chmtime -86500 $BLOB_FILE &&\n+\ttest-chmtime =-86500 $BLOB_FILE &&\n \tgit prune --expire 1.day &&\n \ttest $before = $(git count-objects | sed \"s/ .*//\") &&\n \t! test -f $BLOB_FILE\n@@ -53,11 +53,11 @@ test_expect_success 'gc: implicit prune --expire' '\n \tBLOB_FILE=.git/objects/$(echo $BLOB | sed \"s/^../&\\//\") &&\n \ttest $((1 + $before)) = $(git count-objects | sed \"s/ .*//\") &&\n \ttest -f $BLOB_FILE &&\n-\ttest-chmtime -$((86400*14-30)) $BLOB_FILE &&\n+\ttest-chmtime =-$((86400*14-30)) $BLOB_FILE &&\n \tgit gc &&\n \ttest $((1 + $before)) = $(git count-objects | sed \"s/ .*//\") &&\n \ttest -f $BLOB_FILE &&\n-\ttest-chmtime -$((86400*14+1)) $BLOB_FILE &&\n+\ttest-chmtime =-$((86400*14+1)) $BLOB_FILE &&\n \tgit gc &&\n \ttest $before = $(git count-objects | sed \"s/ .*//\") &&\n \t! test -f $BLOB_FILE\n-- \n1.6.0.rc2.51.g0dc95\n"}]}