+ if echo $1 | egrep "^--" &>/dev/null; then
+ # This is an option argument, leave it untouched
+ ARGS[$i]="$1"
+ elif echo $1 | egrep ".git$" &>/dev/null; then
+ # This is a path to a git repository
+ DIR="$1"
+ # Prepend BASE_PATH if the path does not start with it already.
+ if ! echo $DIR | egrep "^$BASE_PATH" &>/dev/null; then
+ DIR="$BASE_PATH/$DIR"
+ fi
+
+ # Create the git repository if it does not exist yet
+ if [ ! -e "$DIR" ]; then
+ mkdir "$DIR" &> /dev/null && (cd $DIR && git --bare init &> /dev/null)
+ fi
+ ARGS[$i]="$DIR"