From: Felix Dörre Date: Sat, 22 Apr 2017 22:07:44 +0000 (+0200) Subject: upd: manager fetch/push operation X-Git-Url: https://code.wpia.club/?p=infra.git;a=commitdiff_plain;h=b71e7d24baef1c489af6867dd877975349c441e0 upd: manager fetch/push operation Change-Id: I12666cbad482a86f2d70b36b0761907f15b54e22 --- 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 diff --git a/manager/push b/manager/push new file mode 120000 index 0000000..ef77e7f --- /dev/null +++ b/manager/push @@ -0,0 +1 @@ +fetch \ No newline at end of file