FSL_GIT="ssh://git.fsl.cs.sunysb.edu/scm/git"
KORG_GIT="git://git.kernel.org/pub/scm/linux/kernel/git"
+DEBUG="yes" # set to "no" to turn off debug
+
# function to execute commands
runcmd() {
echo "CMD: $@"
if test -z "$1"; then
THIS_REPO=`basename $PWD | sed -e 's/^wrapfs-//' -e 's/\.y$//'`
else
- THIS_REPO="$1"
+ THIS_REPO="$1" # this is how you can "force" a wrapfs-latest clone
+ # to rebase to a stable kernel say, wrapfs-5.18
fi
-#echo THIS_REPO:$THIS_REPO
+test "$DEBUG" eq "yes" && echo THIS_REPO:$THIS_REPO
case "$THIS_REPO" in
2.6.* | 3.* | 4.* | 5.* | latest ) ;;
* ) echo This repo is unknown: $THIS_REPO
;;
esac
-# find out the URL for the remote "origin"`
+# find out the URL for the remote "origin"
# `git remote get-url origin` is the newest syntax but the syntax below
# works on newer and older versions of git
THIS_ORIGIN_URL=`git config --get remote.origin.url 2>/dev/null`
-#echo THIS_ORIGIN_URL=$THIS_ORIGIN_URL
-# expected origin URL
+test "$DEBUG" eq "yes" && echo THIS_ORIGIN_URL=$THIS_ORIGIN_URL
+# expected origin URL (for FSL git server)
case "$THIS_REPO" in
latest ) EXPECTED_ORIGIN_URL="$FSL_GIT/wrapfs-${THIS_REPO}.git" ;;
* ) EXPECTED_ORIGIN_URL="$FSL_GIT/wrapfs-${THIS_REPO}.y.git" ;;
esac
-#echo EXPECTED_ORIGIN_URL=$EXPECTED_ORIGIN_URL
+test "$DEBUG" eq "yes" && echo EXPECTED_ORIGIN_URL=$EXPECTED_ORIGIN_URL
# set new remote URL as needed
if test "$THIS_ORIGIN_URL" != "$EXPECTED_ORIGIN_URL" ; then
fi
fi
-# find out the URL for the remote "korg"`
+# find out the URL for the remote "korg"
THIS_KORG_URL=`git config --get remote.korg.url 2>/dev/null`
-#echo THIS_KORG_URL=$THIS_KORG_URL
+test "$DEBUG" eq "yes" && echo THIS_KORG_URL=$THIS_KORG_URL
# expected korg URL
case "$THIS_REPO" in
latest )
KORG_BRANCH="linux-${THIS_REPO}.y"
;;
esac
-#echo EXPECTED_KORG_URL=$EXPECTED_KORG_URL
+test "$DEBUG" eq "yes" && echo EXPECTED_KORG_URL=$EXPECTED_KORG_URL
# set new remote URL as needed
if test "$THIS_KORG_URL" != "$EXPECTED_KORG_URL" ; then
# grep out the upstream branch for wrapfs
# and set upstream to origin/wrapfs if it isn't already
-WRAPFS_UPSTREAM=`git branch -vv|grep -oP "\*? +wrapfs\s+[0-9a-f]+ \[\K[a-z/]+"`
+WRAPFS_UPSTREAM=`git branch -vv | grep -oP "\*? +wrapfs\s+[0-9a-f]+ \[\K[a-z/]+"`
if test "$WRAPFS_UPSTREAM" != "origin/wrapfs"; then
- if git branch | grep -qP "^\*? +wrapfs$"; then
+ if git branch | grep -qP "^\*? +wrapfs$" ; then
runcmd git branch -u origin/wrapfs wrapfs
else
runcmd git checkout -b wrapfs origin/wrapfs
fi
fi
+# Check if there are any other unknown branches
EXP_BR="origin/master|origin/wrapfs|origin/guilt/wrapfs|korg/$KORG_BRANCH"
-BRANCHES=`git branch -r|grep -vP $EXP_BR`
-if [[ -n $BRANCHES ]]; then
+BRANCHES=`git branch -r | grep -vP $EXP_BR`
+if test -n "$BRANCHES" ; then
echo -e "$0: Found Unexpected Remote Branches:"
- echo "$BRANCHES"|xargs
+ echo "$BRANCHES"
+ exit 1
fi