aboutsummaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rwxr-xr-xshare/hydractl/sync-media-remotes18
1 files changed, 10 insertions, 8 deletions
diff --git a/share/hydractl/sync-media-remotes b/share/hydractl/sync-media-remotes
index a3f9146..0bff710 100755
--- a/share/hydractl/sync-media-remotes
+++ b/share/hydractl/sync-media-remotes
@@ -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