File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ hotfix
2+ sprint-11
3+ new-feature
4+ user-story-5
Original file line number Diff line number Diff line change 22
33echo ' Running commit script'
44
5- IGNORED_BRANCHES=(" dev" " master" " qa" " uat" " staging" )
6- IGNORED_PATH=" ./.ignore"
5+ IGNORED_BRANCHES=(" dev" " master" " qa" " uat" " staging" )
6+
7+ ROOT_DIRECTORY_CMD=" git rev-parse --show-toplevel"
8+ GIT_ROOT_DIRECTORY=$( eval $ROOT_DIRECTORY_CMD )
9+
10+ CUSTOM_IGNORED_PATH=" $GIT_ROOT_DIRECTORY /.smart-commit-ignore"
711
812if [ -f " $IGNORED_PATH " ]
913then
1014 CUSTOM_BRANCHES=$( cat " $IGNORED_PATH " )
11- BRANCHES=( $CUSTOM_BRANCHES )
12- IGNORED_BRANCHES=( ${IGNORED_BRANCHES[@]} ${BRANCHES[@]} )
13- fi
15+ BRANCHES=($CUSTOM_BRANCHES )
16+ IGNORED_BRANCHES=(${IGNORED_BRANCHES[@]} ${BRANCHES[@]} )
17+ fi
1418
1519CURRENT_BRANCH_CMD=" git rev-parse --abbrev-ref HEAD"
1620CURRENT_BRANCH=$( eval $CURRENT_BRANCH_CMD )
@@ -19,7 +23,7 @@ COMMIT_WITH_BRANCH="git commit -m \"$CURRENT_BRANCH: $1\""
1923DEFAULT_COMMIT=" git commit -m \" $1 \" "
2024
2125IS_IGNORED=false
22-
26+
2327for branch in " ${IGNORED_BRANCHES[@]} " ;
2428 do
2529 if [ " $CURRENT_BRANCH " == $branch ]
3438 echo " Commiting with branch name -> $CURRENT_BRANCH "
3539 eval $COMMIT_WITH_BRANCH
3640else
37- echo " Commiting with default branch"
3841 eval $DEFAULT_COMMIT
3942fi
You can’t perform that action at this time.
0 commit comments