Work around Subversion race in git-svn tests.

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>
This commit is contained in:
Michael Spang
2007-02-12 19:33:37 -05:00
committed by Junio C Hamano
parent ccf5aa8dd3
commit 7b3fab877d
5 changed files with 13 additions and 2 deletions

View File

@ -45,3 +45,6 @@ fi
svnrepo="file://$svnrepo" svnrepo="file://$svnrepo"
poke() {
perl -e '@x = stat($ARGV[0]); utime($x[8], $x[9] + 1, $ARGV[0])' "$1"
}

View File

@ -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' \ test_expect_success 'setup some commits to svn' \
'cd test_wc && 'cd test_wc &&
echo Greetings >> kw.c && echo Greetings >> kw.c &&
poke kw.c &&
svn commit -m "Not yet an Id" && svn commit -m "Not yet an Id" &&
echo Hello world >> kw.c && echo Hello world >> kw.c &&
poke kw.c &&
svn commit -m "Modified file, but still not yet an Id" && svn commit -m "Modified file, but still not yet an Id" &&
svn propset svn:keywords Id kw.c && svn propset svn:keywords Id kw.c &&
svn commit -m "Propset Id" poke kw.c &&
svn commit -m "Propset Id" &&
cd ..' cd ..'
test_expect_success 'initialize git-svn' "git-svn init $svnrepo" 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 empty &&
svn propset svn:eol-style CR crlf && svn propset svn:eol-style CR crlf &&
svn propset svn:eol-style CR ne_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 ..' cd ..'
test_expect_success 'fetch and pull latest from svn and checkout a new wc' \ test_expect_success 'fetch and pull latest from svn and checkout a new wc' \

View File

@ -16,6 +16,7 @@ test_expect_success 'initialize repo' "
svn co $svnrepo wc && svn co $svnrepo wc &&
cd wc && cd wc &&
echo feedme >> branches/a/readme && echo feedme >> branches/a/readme &&
poke branches/a/readme &&
svn commit -m hungry && svn commit -m hungry &&
cd trunk && cd trunk &&
svn merge -r3:4 $svnrepo/branches/a && svn merge -r3:4 $svnrepo/branches/a &&

View File

@ -16,11 +16,13 @@ test_expect_success 'initialize repo' "
svn co $svnrepo wc && svn co $svnrepo wc &&
cd wc && cd wc &&
echo world >> trunk/readme && echo world >> trunk/readme &&
poke trunk/readme &&
svn commit -m 'another commit' && svn commit -m 'another commit' &&
svn up && svn up &&
svn mv -m 'rename to thunk' trunk thunk && svn mv -m 'rename to thunk' trunk thunk &&
svn up && svn up &&
echo goodbye >> thunk/readme && echo goodbye >> thunk/readme &&
poke thunk/readme &&
svn commit -m 'bye now' && svn commit -m 'bye now' &&
cd .. cd ..
" "

View File

@ -18,6 +18,7 @@ test_expect_success 'commit change from svn side' "
svn co $svnrepo t.svn && svn co $svnrepo t.svn &&
cd t.svn && cd t.svn &&
echo second line from svn >> file && echo second line from svn >> file &&
poke file &&
svn commit -m 'second line from svn' && svn commit -m 'second line from svn' &&
cd .. && cd .. &&
rm -rf t.svn rm -rf t.svn
@ -45,6 +46,7 @@ test_expect_failure 'dcommit fails to commit because of conflict' "
svn co $svnrepo t.svn && svn co $svnrepo t.svn &&
cd t.svn && cd t.svn &&
echo fourth line from svn >> file && echo fourth line from svn >> file &&
poke file &&
svn commit -m 'fourth line from svn' && svn commit -m 'fourth line from svn' &&
cd .. && cd .. &&
rm -rf t.svn && rm -rf t.svn &&