{"thread":{"id":"33480","subject":"[PATCH v5] transport-helper: report errors properly","startedAt":"2013-04-11T17:47:14Z","lastAt":"2013-04-11T17:47:14Z","messageCount":1,"participants":["Felipe Contreras"],"isPatch":true,"patchVersion":5,"patchTotal":null},"messages":[{"id":"213978","messageId":"1365702434-24704-1-git-send-email-felipe.contreras@gmail.com","threadId":"33480","inReplyTo":null,"subject":"[PATCH v5] transport-helper: report errors properly","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-04-11T17:47:14Z","receivedAt":"2013-04-11T17:47:14Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"If a push fails because the remote-helper died (with fast-export), the\nuser might not see any error message. So let's add one.\n\nSuggested-by: Jeff King <peff@peff.net>\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n git-remote-testgit        | 11 +++++++++++\n t/t5801-remote-helpers.sh | 10 ++++++++++\n transport-helper.c        |  2 +-\n 3 files changed, 22 insertions(+), 1 deletion(-)\n\ndiff --git a/git-remote-testgit b/git-remote-testgit\nindex b395c8d..472ab1a 100755\n--- a/git-remote-testgit\n+++ b/git-remote-testgit\n@@ -67,6 +67,17 @@ do\n \t\techo \"done\"\n \t\t;;\n \texport)\n+\t\tif test -n \"$GIT_REMOTE_TESTGIT_FAILURE\"\n+\t\tthen\n+\t\t\t# consume input so fast-export doesn't get SIGPIPE; we\n+\t\t\t# want to test the remote-helper's code after\n+\t\t\t# fast-export.\n+\t\t\twhile read line; do\n+\t\t\t\ttest \"done\" = \"$line\" && break\n+\t\t\tdone\n+\t\t\texit 1\n+\t\tfi\n+\n \t\tbefore=$(git for-each-ref --format='%(refname) %(objectname)')\n \n \t\tgit fast-import \"${testgitmarks_args[@]}\" --quiet\ndiff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh\nindex f387027..8d61702 100755\n--- a/t/t5801-remote-helpers.sh\n+++ b/t/t5801-remote-helpers.sh\n@@ -166,4 +166,14 @@ test_expect_success 'push ref with existing object' '\n \tcompare_refs local dup server dup\n '\n \n+test_expect_success 'proper failure checks for pushing' '\n+\t(GIT_REMOTE_TESTGIT_FAILURE=1 &&\n+\texport GIT_REMOTE_TESTGIT_FAILURE &&\n+\tcd local &&\n+\ttest_must_fail git push --all 2> error &&\n+\tcat error &&\n+\tgrep -q \"Reading from remote helper failed\" error\n+\t)\n+'\n+\n test_done\ndiff --git a/transport-helper.c b/transport-helper.c\nindex cb3ef7d..96081cc 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -54,7 +54,7 @@ static int recvline_fh(FILE *helper, struct strbuf *buffer)\n \tif (strbuf_getline(buffer, helper, '\\n') == EOF) {\n \t\tif (debug)\n \t\t\tfprintf(stderr, \"Debug: Remote helper quit.\\n\");\n-\t\texit(128);\n+\t\tdie(\"Reading from remote helper failed\");\n \t}\n \n \tif (debug)\n-- \n1.8.2.1\n"}]}