Work around Subversion race in git-svn tests.
authorMichael Spang <mspang@uwaterloo.ca>
Tue, 13 Feb 2007 00:33:37 +0000 (19:33 -0500)
committerJunio C Hamano <junkio@cox.net>
Tue, 13 Feb 2007 06:17:04 +0000 (22:17 -0800)
Some of the git-svn tests can fail on fast machines due to a race in
Subversion: if a file is modified in the same second it was checked out
(or in for that matter), Subversion will not consider it modified. This
works around the problem by increasing the timestamp by one second
before each commit.

[jc: with "touch -r -d" replacement from Eric]

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Michael Spang <mspang@uwaterloo.ca>
Signed-off-by: Junio C Hamano <junkio@cox.net>
t/lib-git-svn.sh
t/t9101-git-svn-props.sh
t/t9103-git-svn-graft-branches.sh
t/t9104-git-svn-follow-parent.sh
t/t9106-git-svn-commit-diff-clobber.sh
index bb1d7b84bcdd3a413e900a0002baf268fa631f3f..67d08cf74083e1b4f045b5c4dfc510f1c3cae5c8 100644 (file)
@@ -45,3 +45,6 @@ fi
 svnrepo="file://$svnrepo"
 
 
+poke() {
+       perl -e '@x = stat($ARGV[0]); utime($x[8], $x[9] + 1, $ARGV[0])' "$1"
+}
index a2c4dc324aed983e3036eaf8efe3b98a63a745c1..e8133d81cb12f22cf4445a63d21d5e595c84fcb0 100755 (executable)
@@ -56,11 +56,14 @@ test_expect_success 'checkout working copy from svn' "svn co $svnrepo test_wc"
 test_expect_success 'setup some commits to svn' \
        'cd test_wc &&
                echo Greetings >> kw.c &&
+               poke kw.c &&
                svn commit -m "Not yet an Id" &&
                echo Hello world >> kw.c &&
+               poke kw.c &&
                svn commit -m "Modified file, but still not yet an Id" &&
                svn propset svn:keywords Id kw.c &&
-               svn commit -m "Propset Id"
+               poke kw.c &&
+               svn commit -m "Propset Id" &&
        cd ..'
 
 test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
@@ -83,7 +86,7 @@ test_expect_success "propset CR on crlf files" \
                svn propset svn:eol-style CR empty &&
                svn propset svn:eol-style CR crlf &&
                svn propset svn:eol-style CR ne_crlf &&
-               svn commit -m "propset CR on crlf files"
+               svn commit -m "propset CR on crlf files" &&
         cd ..'
 
 test_expect_success 'fetch and pull latest from svn and checkout a new wc' \
index 4e55778a47e8423383562a6b45288ff62649318a..183ae3b1c2f0511810c18418c109a2e1412fa8a8 100755 (executable)
@@ -16,6 +16,7 @@ test_expect_success 'initialize repo' "
        svn co $svnrepo wc &&
        cd wc &&
        echo feedme >> branches/a/readme &&
+       poke branches/a/readme &&
        svn commit -m hungry &&
        cd trunk &&
        svn merge -r3:4 $svnrepo/branches/a &&
index 8d2e2fec395a328f4bf6a65af3c7eba5a98cc133..405b5553688d6612177b8730de3e882161e73e85 100755 (executable)
@@ -16,11 +16,13 @@ test_expect_success 'initialize repo' "
        svn co $svnrepo wc &&
        cd wc &&
        echo world >> trunk/readme &&
+       poke trunk/readme &&
        svn commit -m 'another commit' &&
        svn up &&
        svn mv -m 'rename to thunk' trunk thunk &&
        svn up &&
        echo goodbye >> thunk/readme &&
+       poke thunk/readme &&
        svn commit -m 'bye now' &&
        cd ..
        "
index 59b6425ce4e5a265443311b7ed033fe6e8e73add..6f132f2419462c20748b1a6fcb2df36a53ab0f89 100755 (executable)
@@ -18,6 +18,7 @@ test_expect_success 'commit change from svn side' "
        svn co $svnrepo t.svn &&
        cd t.svn &&
        echo second line from svn >> file &&
+       poke file &&
        svn commit -m 'second line from svn' &&
        cd .. &&
        rm -rf t.svn
@@ -45,6 +46,7 @@ test_expect_failure 'dcommit fails to commit because of conflict' "
        svn co $svnrepo t.svn &&
        cd t.svn &&
        echo fourth line from svn >> file &&
+       poke file &&
        svn commit -m 'fourth line from svn' &&
        cd .. &&
        rm -rf t.svn &&