Re: [PATCH] "sleep 1" sleeps too little on cygwin

From: Junio C Hamano <junkio@cox.net>
Date: 2006-01-18 12:41:34
Alex Riesen <raa.lkml@gmail.com> writes:

> Probably another one windows quirk, or just the moon phases,
> but I have to make damn sure it sleeps long enough.

IIRC, DOS file timestamps have 2 seconds granularity, so
sleeping for one second might not be enough to begin with.  Also
I run my cygwin test on sufficiently slow machine, so that may
explain why I have not notice the problem ;-).

Instead of depending on $SECONDS (isn't it a bashism?), how
about doing something like this?

---
diff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh
index e3ebf38..9a5fa38 100755
--- a/t/t4011-diff-symlink.sh
+++ b/t/t4011-diff-symlink.sh
@@ -23,6 +23,7 @@ EOF
 test_expect_success \
     'diff new symlink' \
     'ln -s xyzzy frotz &&
+    touch -t 199901010000 frotz &&
     git-update-index &&
     tree=$(git-write-tree) &&
     git-update-index --add frotz &&
@@ -58,8 +59,8 @@ EOF
 
 test_expect_success \
     'diff identical, but newly created symlink' \
-    'sleep 1 &&
-    ln -s xyzzy frotz &&
+    'ln -s xyzzy frotz &&
+    touch -t 200201010000 frotz &&
     git-diff-index -M -p $tree > current &&
     compare_diff_patch current expected'
 

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Jan 18 12:42:18 2006

This archive was generated by hypermail 2.1.8 : 2006-01-18 12:42:29 EST