Skip to content

Commit b6de6f8

Browse files
committed
Allow users to add custom branches to ignore
1 parent ecb0bb0 commit b6de6f8

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

.commit.swp

-12 KB
Binary file not shown.

commit

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ echo 'Running commit script'
33

44
IGNORED_BRANCHES=("dev" "master" "qa" "uat" "staging")
55

6+
IGNORED_PATH="./.ignore"
7+
if [ -f "$IGNORED_PATH" ]
8+
then
9+
CUSTOM_BRANCHES=$(cat "$IGNORED_PATH")
10+
BRANCHES=( $CUSTOM_BRANCHES )
11+
IGNORED_BRANCHES=( ${IGNORED_BRANCHES[@]} ${BRANCHES[@]} )
12+
fi
13+
14+
615
CURRENT_BRANCH_CMD="git rev-parse --abbrev-ref HEAD"
716
CURRENT_BRANCH=$(eval $CURRENT_BRANCH_CMD)
817

@@ -12,13 +21,14 @@ IS_IGNORED=false
1221

1322
for branch in "${IGNORED_BRANCHES[@]}";
1423
do
15-
if [ "$CURRENT_BRANCH" == ignore ]
24+
if [ "$CURRENT_BRANCH" == $branch ]
1625
then
1726
IS_IGNORED=true
1827
break
1928
fi
2029
done
2130

31+
echo $IS_IGNORED
2232
if [ "$IS_IGNORED" == false ]
2333
then
2434
echo "Commiting with branch name-> $CURRENT_BRANCH"

0 commit comments

Comments
 (0)