Quote all variables in function/program arguments.
diff --git a/git-flow-init b/git-flow-init
index c2e75b2..a8e0825 100644
--- a/git-flow-init
+++ b/git-flow-init
@@ -27,47 +27,47 @@
fi
if ! git rev-parse --quiet --verify HEAD 2>&1 >/dev/null; then
- touch $README
- git add $README
+ touch "$README"
+ git add "$README"
git commit --quiet -m "initial commit"
if [ "$MASTER_BRANCH" != "master" ]; then
- git branch -m master $MASTER_BRANCH
+ git branch -m master "$MASTER_BRANCH"
fi
echo "- An initial commit was created at branch '$MASTER_BRANCH'"
fi
- if ! git rev-parse --verify $MASTER_BRANCH 2>&1 >/dev/null; then
+ if ! git rev-parse --verify "$MASTER_BRANCH" 2>&1 >/dev/null; then
die "Cannot find your master branch. Try: git branch -m <mymaster> $MASTER_BRANCH"
fi
gitflow_require_clean_working_tree
- if git remote | grep -q $ORIGIN; then
- git fetch -q $ORIGIN
- gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
+ if git remote | grep -q "$ORIGIN"; then
+ git fetch -q "$ORIGIN"
+ gitflow_require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
fi
- if git rev-parse --verify $DEVELOP_BRANCH 2>&1 >/dev/null; then
- gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
+ if git rev-parse --verify "$DEVELOP_BRANCH" 2>&1 >/dev/null; then
+ gitflow_require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
else
- git checkout -q -b $DEVELOP_BRANCH $MASTER_BRANCH
+ git checkout -q -b "$DEVELOP_BRANCH" "$MASTER_BRANCH"
echo "- A new branch '$DEVELOP_BRANCH' was created"
echo "- You are now on branch '$DEVELOP_BRANCH'"
fi
- if ! git remote | grep -q $ORIGIN; then
+ if ! git remote | grep -q "$ORIGIN"; then
if [ "$1" = "" ]; then
echo "- No remote location was added. Try: git remote add $ORIGIN <url>"
else
- git remote add $ORIGIN $1
+ git remote add "$ORIGIN" "$1"
echo "- A new remote location '$1' was added"
fi
fi
echo
- if git remote | grep -q $ORIGIN; then
- git push $ORIGIN $MASTER_BRANCH $DEVELOP_BRANCH
+ if git remote | grep -q "$ORIGIN"; then
+ git push "$ORIGIN" "$MASTER_BRANCH" "$DEVELOP_BRANCH"
fi
}