MASTER_REPO=${MASTER_GIT}/${GIT_NAME}
# if the local master is a symlink (like /git/vserver-reference.git -> sliceref.git)
- # then skip it, the target itself will be handled if in scope
+ # then skip it
+ # we use this for either aliases (like vserver-reference and sliceimage) or
+ # for repos managed in other locations (like /git-slave) but where
+ # the symlink is needed so they get served by git-daemon
[ -h ${MASTER_REPO} ] && return
# if there is no remote repository it may be that we only have
--- /dev/null
+#!/bin/bash
+#
+# uses the directory where the command lies, so just symlink this script wherever it's needed
+#
+# based on auto-update that historically was guessing the scm in use
+# this one is git-specific, it does the usual git pull
+# but also exposes all remote branches as local
+#
+
+####################
+COMMAND=$(basename $0)
+# without an argument, use the place where the command is stored
+if [[ -z "$@" ]] ; then
+ DIRNAME=$(dirname $0)
+ DIRNAME=$(cd $DIRNAME; pwd -P)
+else
+ DIRNAME="$1" ; shift
+fi
+
+##########
+cd $DIRNAME
+
+function all_branches () {
+ remote=$1; shift
+ git branch -r | grep $remote | fgrep -v -- '->' | sed "s/.*\///g"
+}
+
+
+function git_update () {
+ echo Running $COMMAND
+ remote=origin
+ for branch in $(all_branches $remote); do
+ # create the branch as a tracking branch if not yet existing
+ git branch | grep -q ' '$branch'$' || git branch --track $branch $remote/$branch
+ git checkout $branch
+ git merge --ff $remote/$branch
+}
+
+git_update >& .git-update.log