[med-svn] [Git][med-team/community/helper-scripts][master] Fix test whether project exists

Andreas Tille gitlab at salsa.debian.org
Sun Mar 10 13:20:26 GMT 2019


Andreas Tille pushed to branch master at Debian Med / community / helper-scripts


Commits:
8a4b2a23 by Andreas Tille at 2019-03-10T13:18:46Z
Fix test whether project exists

- - - - -


1 changed file:

- inject-into-salsa-git


Changes:

=====================================
inject-into-salsa-git
=====================================
@@ -41,12 +41,15 @@ fi
 
 # Did we already push to salsa?
 set +e
+set -x
 RESPONSE=$(curl "$SALSA_URL/projects?search=${DEBPKGNAME}")
 echo $RESPONSE | jq --exit-status "map(select(.path == \"${DEBPKGNAME}\")) | .[0].id" > /dev/null
 set -e
-if [ $? -ne 0 ]; then
+if [ $? -eq 0 ]; then
     # Seems like not, lets create a project
     set -x
+    echo "Project ${DEBPKGNAME} does not exists on Salsa - just create the project"
+    echo "ATTENTION: If this fails for you ask for **Maintainer** permissions in your project"
     RESPONSE=$(curl "$SALSA_URL/projects?private_token=$SALSA_TOKEN" \
         --data "path=${DEBPKGNAME}&namespace_id=${SALSA_GROUP_ID}&description=${SHORTDESC}&visibility=public")
 
@@ -57,6 +60,7 @@ if [ $? -ne 0 ]; then
     set +x
 else
     set -x
+    echo "Project ${DEBPKGNAME} exists on Salsa - just update some metadata"
     PROJECT_ID=$(echo $RESPONSE | jq "map(select(.path == \"${DEBPKGNAME}\")) | .[0].id")
     set +x
 fi
@@ -64,7 +68,7 @@ fi
 set +e
 git remote show origin
 set -e
-if [ $? -ne 0 ] ; then
+if [ $? -eq 0 ] ; then
     git remote add origin git at salsa.debian.org:${SALSA_GROUP}/${DEBPKGNAME}.git
 fi
 git push origin master



View it on GitLab: https://salsa.debian.org/med-team/community/helper-scripts/commit/8a4b2a23ebf7878ed514f18c21a18b9920fbf8b7

-- 
View it on GitLab: https://salsa.debian.org/med-team/community/helper-scripts/commit/8a4b2a23ebf7878ed514f18c21a18b9920fbf8b7
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20190310/336ff5b2/attachment-0001.html>


More information about the debian-med-commit mailing list