]> gitweb.fluxo.info Git - hydra.git/commitdiff
Workaround for git-remote at sync-media-remotes
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 9 Nov 2016 11:03:17 +0000 (09:03 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 9 Nov 2016 11:03:17 +0000 (09:03 -0200)
share/hydractl/sync-media-remotes

index a3f91461c8f4da335681537543a52afd0240dd56..0bff710f815786f3219026f55a8879cb242ff868 100755 (executable)
@@ -27,16 +27,18 @@ for folder in `ls $MEDIA`; do
       addr="`echo $remote | cut -d ' ' -f 2`"
       type="`echo $remote | cut -d ' ' -f 3`"
 
-      if [ "$type" == "(push)" ]; then
-        command="set-url --add --push"
-      else
-        command="add"
-      fi
-
       if ! git remote -v | sed -e 's/\t/ /g' | grep -q "^$name $addr $type$"; then
-        # This might not sync everything in the first run as some weird behavior.
+        # Check if was not already added by a previous command
+        if ! git remote | grep -q "^$name$"; then
+          git remote add $name $addr
+        fi
+
+        # This might not sync everything in the first run due to unreliable "git remote -v" output.
         # See https://github.com/git/git-scm.com/issues/886
-        git remote $command $name $addr
+        #if [ "$type" == "(push)" ]; then
+        #  git remote set-url --add --push $name $addr
+        #fi
+        git remote set-url --add --push $name $addr
       fi
     done