X-Git-Url: https://code.wpia.club/?p=infra.git;a=blobdiff_plain;f=manager%2Ffetch;h=184e4889c7245a1bd916da234427857b89d1a273;hp=809b1bf0ffe6689a724a1edaf102e85e2d240e6f;hb=b71e7d24baef1c489af6867dd877975349c441e0;hpb=a9ef86e37fe77a728b175831bd7d3d928edd054b diff --git a/manager/fetch b/manager/fetch old mode 100644 new mode 100755 index 809b1bf..184e488 --- a/manager/fetch +++ b/manager/fetch @@ -2,7 +2,9 @@ function ssh_target { ssh -i vm-key "$to" "$@" } -source "$1/config" +target=$1 +target=${target%/} +source "$target/config" echo "To: $to" echo "Agent: $SSH_AGENT_PID" @@ -11,9 +13,13 @@ if [[ $oldpid == "" ]]; then eval $(ssh-agent) ssh-add vm-key fi - -git fetch "$to:" "HEAD:refs/remotes/$1" - +command=$(basename -- "$0") +echo "Action: $command" +if [[ $command == "push" ]]; then + git push -f "$to:" "HEAD:refs/remotes/manager/master" +else + git fetch "$to:" "+HEAD:refs/remotes/$target/master" +fi if [[ $oldpid == "" ]]; then eval $(ssh-agent -k) fi