]> gitweb.fluxo.info Git - hydra.git/commitdiff
Minor fixes at sync-media-remotes
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 8 Nov 2016 18:31:29 +0000 (16:31 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 8 Nov 2016 18:31:29 +0000 (16:31 -0200)
share/hydractl/sync-media-remotes

index 1b8f59ea97556b7d8c44a884df8c1ecc471e7a95..f3ea06210bb2289382fca701a686d8d020bc31ac 100755 (executable)
@@ -24,7 +24,7 @@ for folder in `ls $MEDIA`; do
     git -C $MEDIA/$folder remote -v | while read remote; do
       cd $DEST/$MEDIA/$folder
       name="`echo $remote | cut -d ' ' -f 1`"
-      addr="`echo $remote | cut -d  ' ' -f 2`"
+      addr="`echo $remote | cut -d ' ' -f 2`"
       type="`echo $remote | cut -d ' ' -f 3`"
 
       if [ "$type" == "(push)" ]; then
@@ -42,7 +42,7 @@ for folder in `ls $MEDIA`; do
     git -C $DEST/$MEDIA/$folder remote -v | while read remote; do
       cd $MEDIA/$folder
       name="`echo $remote | cut -d ' ' -f 1`"
-      addr="`echo $remote | cut -d  ' ' -f 2`"
+      addr="`echo $remote | cut -d ' ' -f 2`"
       type="`echo $remote | cut -d ' ' -f 3`"
 
       if [ "$type" == "(push)" ]; then
@@ -54,7 +54,10 @@ for folder in `ls $MEDIA`; do
       fi
 
       if ! git remote -v | sed -e 's/\t/ /g' | grep -q "^$name $addr $type$"; then
-        git -C $DEST/$MEDIA/$folder remote $command $name $arg
+        # Check if was not already removed by a previous command
+        if git -C $DEST/$MEDIA/$folder remote | grep -q "^$name$"; then
+          git -C $DEST/$MEDIA/$folder remote $command $name $arg
+        fi
       fi
     done
   fi