diff options
-rw-r--r-- | brep/handler/submit/submit-git.in | 21 | ||||
-rw-r--r-- | tests/submit/submit-git.testscript | 6 |
2 files changed, 23 insertions, 4 deletions
diff --git a/brep/handler/submit/submit-git.in b/brep/handler/submit/submit-git.in index c882b84..f4e36a3 100644 --- a/brep/handler/submit/submit-git.in +++ b/brep/handler/submit/submit-git.in @@ -618,9 +618,24 @@ for i in {1..11}; do check_connectivity "$control" "$git_timeout" "" - if ! run_silent git "${git_http_timeout[@]}" clone $gqo $gvo --depth 1 \ ---single-branch --branch "build2-control" "$control" "$ctl_dir" >&2; then - exit_with_manifest 422 "failed to git-clone $control" + cmd=(git "${git_http_timeout[@]}" clone $gqo $gvo --depth 1 \ +--single-branch --branch "build2-control" "$control" "$ctl_dir") + + trace_cmd "${cmd[@]}" + + # Let's add the git-clone error message to the response, turning it into + # an info. This way the user may potentially see the following + # bdep-publish diagnostics: + # + # error: failed to git-clone build2-control branch of https://example.com/foo/bar + # info: Could not find remote branch build2-control to clone. + # info: Remote branch build2-control not found in upstream origin + # info: reference: 8589b4484f36 + # + if ! e="$("${cmd[@]}" 2>&1)"; then + e="$(sed -E -e 's/^(error|fatal|warning):/ info:/' <<<"$e")" + e="failed to git-clone build2-control branch of $control"$'\n'"$e" + exit_with_manifest 422 "$e" fi if [ ! -f "$ctl_dir/submit/${sha256sum:0:16}" ]; then diff --git a/tests/submit/submit-git.testscript b/tests/submit/submit-git.testscript index 5197afc..ecd0527 100644 --- a/tests/submit/submit-git.testscript +++ b/tests/submit/submit-git.testscript @@ -1064,7 +1064,11 @@ pkg_ctl="$prj_ctl/hello.git" $* "file:///$~/tgt.git" $data_dir >>"EOO" : 1 status: 422 - message: failed to git-clone http://example.com/path/rep.git + message: + \\ + failed to git-clone http://example.com/path/rep.git + info: repository 'http://example.com/path/rep.git/' not found + \\ reference: $checksum EOO } |