From c900e6e22548b9a3e34392e1331dd38eead8199b Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 9 Nov 2016 09:03:17 -0200 Subject: Workaround for git-remote at sync-media-remotes --- share/hydractl/sync-media-remotes | 18 ++++++++++-------- 1 file 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 -- cgit v1.2.3