Skip to content

Commit d11c5d2

Browse files
committed
Fix indentation
1 parent 3d895e4 commit d11c5d2

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

commit

100644100755
Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,35 @@ then
1212
IGNORED_BRANCHES=( ${IGNORED_BRANCHES[@]} ${BRANCHES[@]} )
1313
fi
1414

15+
IGNORED_BRANCHES=("dev" "master" "qa" "uat" "staging")
16+
IGNORED_PATH="./.ignore"
17+
18+
if [ -f "$IGNORED_PATH" ]
19+
then
20+
CUSTOM_BRANCHES=$(cat "$IGNORED_PATH")
21+
BRANCHES=( $CUSTOM_BRANCHES )
22+
IGNORED_BRANCHES=( ${IGNORED_BRANCHES[@]} ${BRANCHES[@]} )
23+
fi
24+
25+
1526
CURRENT_BRANCH_CMD="git rev-parse --abbrev-ref HEAD"
1627
CURRENT_BRANCH=$(eval $CURRENT_BRANCH_CMD)
1728

1829
COMMIT_WITH_BRANCH="git commit -m \"$CURRENT_BRANCH: $1\""
1930
DEFAULT_COMMIT="git commit -m \"$1\""
2031

21-
if [ "$CURRENT_BRANCH" != "dev" ] && [ "$CURRENT_BRANCH" != "master" ] && [ "$CURRENT_BRANCH" != "qa" ] && [ "$CURRENT_BRANCH" != "uat" ] && [ "$CURRENT_BRANCH" != "staging" ]
32+
IS_IGNORED=false
33+
34+
for branch in "${IGNORED_BRANCHES[@]}";
35+
do
36+
if [ "$CURRENT_BRANCH" == $branch ]
37+
then
38+
IS_IGNORED=true
39+
break
40+
fi
41+
done
42+
43+
if [ "$IS_IGNORED" == false ]
2244
then
2345
echo "Commiting with branch name -> $CURRENT_BRANCH"
2446
eval $COMMIT_WITH_BRANCH

0 commit comments

Comments
 (0)