#!/bin/bash
REMOTE=origin
+CHECKNEW=true
-while getopts "r:" opt; do
+while getopts "r:c" opt; do
case $opt in
r)
- REMOTE=$OPTARG
+ REMOTE=$OPTARG
+ ;;
+ c)
+ CHECKNEW=false
+ ;;
esac
done
CHECKED=`git branch | grep $BRANCH`
if [ "$CHECKED" = "" ]; then
- echo "Branch $BRANCH to be checked"
+ MSG="Branch $BRANCH to be checked"
+ if [ "$CHECKNEW" = false ]; then
+ MSG=$MSG" (but not checked as requested)"
+ fi
+ MSG=$MSG"."
+ echo $MSG
fi
-
- git checkout $BRANCH &>> log.log
- "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/debian_tobeupdated.sh &>> log.log
- if [ $? -eq 1 ]; then
- echo "Branch $BRANCH must be updated."
+ if [ "$CHECKED" != "" ] || ([ "$CHECKED" = "" ] && [ "$CHECKNEW" = true ]); then
+ git checkout $BRANCH &>> log.log
+
+ "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/debian_tobeupdated.sh &>> log.log
+ if [ $? -eq 1 ]; then
+ echo "Branch $BRANCH must be updated."
+ fi
fi
done