mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
feat(make): add file name pre-commit for githook
Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
parent
1a034cfc66
commit
0ef4fbfa5a
17
script/githooks/pre-commit.sh
Normal file
17
script/githooks/pre-commit.sh
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
LC_ALL=C
|
||||||
|
|
||||||
|
local_branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
|
|
||||||
|
valid_branch_regex="^(master|develop)$|(feature|release|hotfix)\/[a-z0-9._-]+$|^HEAD$"
|
||||||
|
|
||||||
|
message="There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex.
|
||||||
|
Your commit will be rejected. You should rename your branch to a valid name and try again."
|
||||||
|
|
||||||
|
if [[ ! $local_branch =~ $valid_branch_regex ]]
|
||||||
|
then
|
||||||
|
echo "$message"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
@ -120,7 +120,7 @@ MAKEFLAGS += --no-print-directory
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Copy githook scripts when execute makefile
|
# Copy githook scripts when execute makefile
|
||||||
COPY_GITHOOK:=$(shell cp -f githooks/* .git/hooks/)
|
COPY_GITHOOK:=$(shell cp -f script/githooks/* .git/hooks/)
|
||||||
|
|
||||||
# COMMA: Concatenate multiple strings to form a list of strings
|
# COMMA: Concatenate multiple strings to form a list of strings
|
||||||
COMMA := ,
|
COMMA := ,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user