[med-svn] [Git][med-team/community/helper-scripts][master] Check for existing origin

Steffen Möller (@moeller) gitlab at salsa.debian.org
Mon Aug 2 16:58:24 BST 2021



Steffen Möller pushed to branch master at Debian Med / community / helper-scripts


Commits:
1c87411e by Steffen at 2021-08-02T17:58:18+02:00
Check for existing origin

- - - - -


1 changed file:

- inject-into-salsa-git


Changes:

=====================================
inject-into-salsa-git
=====================================
@@ -117,11 +117,17 @@ else
     set +x
 fi
 
-set +e
-git remote show origin
-set -e
-if [ $? -eq 0 ] ; then
-    git remote add origin git at salsa.debian.org:${SALSA_GROUP}/${DEBPKGNAME}.git
+remoteOrigin="git at salsa.debian.org:${SALSA_GROUP}/${DEBPKGNAME}.git"
+if git remote | grep -q origin ; then
+    echo "I: remote repository 'origin' is already existing"
+    if git remote -v | grep origin | grep -q "$remoteOrigin"; then
+        echo "   But already set as wanted ($remoteOrigin) - nothing to do."
+    else
+        git remote rename origin origin-$(date +"%Y%m%dT%T")
+        git remote add origin $remoteOrigin
+    fi
+else
+    git remote add origin $remoteOrigin
 fi
 
 # Change config file



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

-- 
View it on GitLab: https://salsa.debian.org/med-team/community/helper-scripts/-/commit/1c87411ea5045af9f6cd2408709b8775b07f1db0
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/20210802/eb385333/attachment.htm>


More information about the debian-med-commit mailing list