Skip to content

Commit 6c32332

Browse files
felipecpeff
authored andcommitted
remote-testgit: properly check for errors
'feature done' was missing, which allowed fast-import exit properly, and transport-helper to continue checking for refs and what not when in fact the remote-helper died. Let's enable that, and make sure the error paths are triggered. Now transport-helper correctly detects the errors from fast-import, unfortunately, not from fast-export because it might finish before detecting a SIGPIPE. This means transport-helper will quit silently and the user will not see any errors, which is bad. Hopefully the helper will print the error before dying anyway, so not all is lost. Signed-off-by: Felipe Contreras <[email protected]> Signed-off-by: Jeff King <[email protected]>
1 parent 2cfceef commit 6c32332

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

git-remote-testgit.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ def do_import(repo, args):
159159
ref = line[7:].strip()
160160
refs.append(ref)
161161

162+
print "feature done"
163+
164+
if os.environ.get("GIT_REMOTE_TESTGIT_FAILURE"):
165+
die('Told to fail')
166+
162167
repo = update_local_repo(repo)
163168
repo.exporter.export_repo(repo.gitdir, refs)
164169

@@ -172,6 +177,9 @@ def do_export(repo, args):
172177
if not repo.gitdir:
173178
die("Need gitdir to export")
174179

180+
if os.environ.get("GIT_REMOTE_TESTGIT_FAILURE"):
181+
die('Told to fail')
182+
175183
update_local_repo(repo)
176184
changed = repo.importer.do_import(repo.gitdir)
177185

t/t5800-remote-helpers.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,25 @@ test_expect_failure 'push new branch with old:new refspec' '
145145
compare_refs clone HEAD server refs/heads/new-refspec
146146
'
147147

148+
test_expect_success 'proper failure checks for fetching' '
149+
(GIT_REMOTE_TESTGIT_FAILURE=1 &&
150+
export GIT_REMOTE_TESTGIT_FAILURE &&
151+
cd localclone &&
152+
test_must_fail git fetch 2>&1 | \
153+
grep "Error while running fast-import"
154+
)
155+
'
156+
157+
# We sleep to give fast-export a chance to catch the SIGPIPE
158+
test_expect_failure 'proper failure checks for pushing' '
159+
(GIT_REMOTE_TESTGIT_FAILURE=1 &&
160+
export GIT_REMOTE_TESTGIT_FAILURE &&
161+
GIT_REMOTE_TESTGIT_SLEEPY=1 &&
162+
export GIT_REMOTE_TESTGIT_SLEEPY &&
163+
cd localclone &&
164+
test_must_fail git push --all 2>&1 | \
165+
grep "Error while running fast-export"
166+
)
167+
'
168+
148169
test_done

0 commit comments

Comments
 (0)