-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from lovato/feature/windowscheckbranchfix
files w/o ext wont work on windows/gitbash
- Loading branch information
Showing
4 changed files
with
26 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
check_branch_name.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
if [ -z "$1" ] | ||
then | ||
valid='^(feature|bugfix|hotfix)\/.+' | ||
else | ||
valid="$1" | ||
fi | ||
|
||
# branch=`git rev-parse --abbrev-ref HEAD` | ||
# branch=`git symbolic-ref --short HEAD` # https://stackoverflow.com/questions/6245570/how-to-get-the-current-branch-name-in-git | ||
branch=$(git status | head -1 | sed -n '/On branch /s///p') | ||
|
||
if [[ $branch =~ $valid ]]; then | ||
echo Branch is OK with naming conventions | ||
else | ||
echo Your branch \'$branch\' needs a better name to match conventions. Sorry. | ||
echo This rules branch naming: $valid | ||
echo You can try a few at https://regex101.com/ | ||
echo Then, please, follow these steps if needed: | ||
echo - http://tinyurl.com/renamegitbranches | ||
exit 1 | ||
fi |