aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-08-28 17:10:37 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-08-28 21:46:41 +0300
commit9ffc9c2c72c57c381a0af44a52f2fe6dff73171c (patch)
tree7fd256a4f8939dc97ba1e513b3502acd1e6d5415
parent8a094bb0481a9c53646cc15db2e8acecafc3d10c (diff)
Fix submit-git not to authenticate/authorize if submission is simulated
-rw-r--r--brep/handler/submit/submit-git.in38
1 files changed, 21 insertions, 17 deletions
diff --git a/brep/handler/submit/submit-git.in b/brep/handler/submit/submit-git.in
index 47f9a1a..461aab4 100644
--- a/brep/handler/submit/submit-git.in
+++ b/brep/handler/submit/submit-git.in
@@ -367,6 +367,18 @@ if [ -z "$project" ]; then
project="$name"
fi
+# Exit with the 'submission is queued' result manifest if simulating.
+#
+# Note that we can't expect a real control repository URL to be specified for
+# simulating, so trying to authenticate/authorize would be meaningless.
+#
+if [ -n "$simulate" ]; then
+ run rm -r -f "$data_dir"
+
+ trace "$name/$version submission is simulated"
+ exit_with_manifest 200 "$name/$version submission is queued" "$reference"
+fi
+
function git_add () # <repo-dir> <path>...
{
local d="$1"
@@ -628,18 +640,15 @@ EOF
check_connectivity "$tgt_repo" "$git_timeout"
- # Try to push the target modifications, unless simulating. If this succeeds
- # then we are done. Otherwise, drop the target directory and re-try the
- # whole authentication/authorization procedure, unless we are out of
- # attempts.
+ # Try to push the target modifications. If this succeeds then we are done.
+ # Otherwise, drop the target directory and re-try the whole
+ # authentication/authorization procedure, unless we are out of attempts.
#
- if [ -z "$simulate" ]; then
- if run_silent git "${git_http_timeout[@]}" -C "$tgt_dir" push >&2; then
- pkg_added=true
- break
- else
- run rm -r -f "$tgt_dir" "$ctl_dir"
- fi
+ if run_silent git "${git_http_timeout[@]}" -C "$tgt_dir" push >&2; then
+ pkg_added=true
+ break
+ else
+ run rm -r -f "$tgt_dir" "$ctl_dir"
fi
done
@@ -651,10 +660,5 @@ fi
#
run rm -r -f "$data_dir"
-if [ -n "$simulate" ]; then
- trace "$name/$version submission is simulated"
-else
- trace "$name/$version submission is queued"
-fi
-
+trace "$name/$version submission is queued"
exit_with_manifest 200 "$name/$version submission is queued"