From: Junio C Hamano Date: Fri, 7 Jun 2013 23:15:32 +0000 (-0700) Subject: Merge branch 'js/transport-helper-error-reporting-fix' into fc/makefile X-Git-Tag: v1.8.4-rc0~162^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=81b4f18fb8f9356477157a3b9f0652d371cba835;p=thirdparty%2Fgit.git Merge branch 'js/transport-helper-error-reporting-fix' into fc/makefile * js/transport-helper-error-reporting-fix: git-remote-testgit: build it to run under $SHELL_PATH git-remote-testgit: further remove some bashisms git-remote-testgit: avoid process substitution t5801: "VAR=VAL shell_func args" is forbidden transport-helper: update remote helper namespace transport-helper: trivial code shuffle transport-helper: warn when refspec is not used transport-helper: clarify pushing without refspecs transport-helper: update refspec documentation transport-helper: clarify *:* refspec transport-helper: improve push messages transport-helper: mention helper name when it dies transport-helper: report errors properly Conflicts: t/t5801-remote-helpers.sh --- 81b4f18fb8f9356477157a3b9f0652d371cba835 diff --cc t/t5801-remote-helpers.sh index dbb02e2afd,0a83db8875..61479c3b16 --- a/t/t5801-remote-helpers.sh +++ b/t/t5801-remote-helpers.sh @@@ -6,13 -6,7 +6,8 @@@ test_description='Test remote-helper import and export commands' . ./test-lib.sh +. "$TEST_DIRECTORY"/lib-gpg.sh - if ! type "${BASH-bash}" >/dev/null 2>&1; then - skip_all='skipping remote-testgit tests, bash not available' - test_done - fi - compare_refs() { git --git-dir="$1/.git" rev-parse --verify $2 >expect && git --git-dir="$3/.git" rev-parse --verify $4 >actual && @@@ -167,25 -150,38 +151,57 @@@ test_expect_success 'push ref with exis compare_refs local dup server dup ' +test_expect_success GPG 'push signed tag' ' + (cd local && + git checkout master && + git tag -s -m signed-tag signed-tag && + git push origin signed-tag + ) && + compare_refs local signed-tag^{} server signed-tag^{} && + test_must_fail compare_refs local signed-tag server signed-tag +' + +test_expect_success GPG 'push signed tag with signed-tags capability' ' + (cd local && + git checkout master && + git tag -s -m signed-tag signed-tag-2 && + GIT_REMOTE_TESTGIT_SIGNED_TAGS=1 git push origin signed-tag-2 + ) && + compare_refs local signed-tag-2 server signed-tag-2 +' + + test_expect_success 'push update refs' ' + (cd local && + git checkout -b update master && + echo update >>file && + git commit -a -m update && + git push origin update + git rev-parse --verify remotes/origin/update >expect && + git rev-parse --verify testgit/origin/heads/update >actual && + test_cmp expect actual + ) + ' + + test_expect_success 'proper failure checks for fetching' ' + (GIT_REMOTE_TESTGIT_FAILURE=1 && + export GIT_REMOTE_TESTGIT_FAILURE && + cd local && + test_must_fail git fetch 2> error && + cat error && + grep -q "Error while running fast-import" error + ) + ' + + test_expect_success 'proper failure checks for pushing' ' + (GIT_REMOTE_TESTGIT_FAILURE=1 && + export GIT_REMOTE_TESTGIT_FAILURE && + cd local && + test_must_fail git push --all 2> error && + cat error && + grep -q "Reading from helper .git-remote-testgit. failed" error + ) + ' + test_expect_success 'push messages' ' (cd local && git checkout -b new_branch master && diff --cc transport-helper.c index 522d79178e,92174095ed..f11d78a55a --- a/transport-helper.c +++ b/transport-helper.c @@@ -214,9 -212,12 +215,11 @@@ static struct child_process *get_helper int i; data->refspec_nr = refspec_nr; data->refspecs = parse_fetch_refspec(refspec_nr, refspecs); - for (i = 0; i < refspec_nr; i++) { + for (i = 0; i < refspec_nr; i++) free((char *)refspecs[i]); - } free(refspecs); + } else if (data->import || data->bidi_import || data->export) { + warning("This remote helper should implement refspec capability."); } strbuf_release(&buf); if (debug)