File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212 IGNORED_BRANCHES=( ${IGNORED_BRANCHES[@]} ${BRANCHES[@]} )
1313fi
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+
1526CURRENT_BRANCH_CMD=" git rev-parse --abbrev-ref HEAD"
1627CURRENT_BRANCH=$( eval $CURRENT_BRANCH_CMD )
1728
1829COMMIT_WITH_BRANCH=" git commit -m \" $CURRENT_BRANCH : $1 \" "
1930DEFAULT_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 ]
2244then
2345 echo " Commiting with branch name -> $CURRENT_BRANCH "
2446 eval $COMMIT_WITH_BRANCH
You can’t perform that action at this time.
0 commit comments