X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=manager%2Ffetch;h=7e7f1e1c400a4168fcd3277761b229457c3040e3;hb=d0c1d363560847e3f0aacaf80ab1f8101d86248b;hp=809b1bf0ffe6689a724a1edaf102e85e2d240e6f;hpb=81dc8132d05121442ac1396d094b67e793ab38b0;p=infra.git diff --git a/manager/fetch b/manager/fetch old mode 100644 new mode 100755 index 809b1bf..7e7f1e1 --- a/manager/fetch +++ b/manager/fetch @@ -1,8 +1,8 @@ #!/bin/bash -function ssh_target { - ssh -i vm-key "$to" "$@" -} -source "$1/config" +targetHost=$1 +targetHost=${targetHost%/} +source config +source "$targetHost/config" echo "To: $to" echo "Agent: $SSH_AGENT_PID" @@ -11,9 +11,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/$targetHost/master" +fi if [[ $oldpid == "" ]]; then eval $(ssh-agent -k) fi