File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 2222 _digest = sha .new
2323import sys
2424import os
25+ import time
2526sys .path .insert (0 , os .getenv ("GITPYTHONLIB" ,"." ))
2627
2728from git_remote_helpers .util import die , debug , warn
@@ -204,6 +205,11 @@ def read_one_line(repo):
204205 """Reads and processes one command.
205206 """
206207
208+ sleepy = os .environ .get ("GIT_REMOTE_TESTGIT_SLEEPY" )
209+ if sleepy :
210+ debug ("Sleeping %d sec before readline" % int (sleepy ))
211+ time .sleep (int (sleepy ))
212+
207213 line = sys .stdin .readline ()
208214
209215 cmdline = line
@@ -258,6 +264,7 @@ def main(args):
258264
259265 more = True
260266
267+ sys .stdin = os .fdopen (sys .stdin .fileno (), 'r' , 0 )
261268 while (more ):
262269 more = read_one_line (repo )
263270
Original file line number Diff line number Diff line change @@ -72,6 +72,19 @@ test_expect_success 'pushing to local repo' '
7272 compare_refs localclone HEAD server HEAD
7373'
7474
75+ # Generally, skip this test. It demonstrates a now-fixed race in
76+ # git-remote-testgit, but is too slow to leave in for general use.
77+ : test_expect_success ' racily pushing to local repo' '
78+ test_when_finished "rm -rf server2 localclone2" &&
79+ cp -a server server2 &&
80+ git clone "testgit::${PWD}/server2" localclone2 &&
81+ (cd localclone2 &&
82+ echo content >>file &&
83+ git commit -a -m three &&
84+ GIT_REMOTE_TESTGIT_SLEEPY=2 git push) &&
85+ compare_refs localclone2 HEAD server2 HEAD
86+ '
87+
7588test_expect_success ' synch with changes from localclone' '
7689 (cd clone &&
7790 git pull)
You can’t perform that action at this time.
0 commit comments