]> WPIA git - infra.git/commitdiff
upd: manager fetch/push operation
authorFelix Dörre <felix@dogcraft.de>
Sat, 22 Apr 2017 22:07:44 +0000 (00:07 +0200)
committerFelix Dörre <felix@dogcraft.de>
Sat, 3 Jun 2017 15:14:33 +0000 (17:14 +0200)
Change-Id: I12666cbad482a86f2d70b36b0761907f15b54e22

manager/fetch [changed mode: 0644->0755]
manager/push [new symlink]

old mode 100644 (file)
new mode 100755 (executable)
index 809b1bf..184e488
@@ -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 (symlink)
index 0000000..ef77e7f
--- /dev/null
@@ -0,0 +1 @@
+fetch
\ No newline at end of file