Skip to content

Commit

Permalink
Merge pull request #65 from WGrape/test
Browse files Browse the repository at this point in the history
feat: 新增unhook取消全局钩子功能
  • Loading branch information
WGrape authored Oct 22, 2022
2 parents f1fb7e2 + 3b0810b commit 9ca8cfb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ git config --global --add core.fileMode false
posture sethook
```

当需要取消全局钩子时, 执行unsethook命令即可

```bash
posture unsethook
```

### <span id="321">(1) checkout钩子</span>
当使用```git checkout/git switch```命令时,会自动执行checkout钩子,如下图所示。

Expand Down
2 changes: 1 addition & 1 deletion config/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ dingToken="example"
loadingSpeed=4

# the protect rules
protectMainSwitch="on"
protectMainSwitch="off"
5 changes: 5 additions & 0 deletions include/function.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ sethook(){
# 如果个别项目不需要使用全局的Hook, 可以在项目的根目录下重新配置git hooksPath: git config core.hooksPath .git/hooks
}

# 取消设置全局Hook
unsethook(){
git config --global core.hooksPath false
}

# 检查配置
checkConfig(){
checkLang
Expand Down
2 changes: 2 additions & 0 deletions posture
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ fi
COMMAND=$1
if [ "${COMMAND}" == "sethook" ]; then
sethook $POSTUREPATH
elif [ "${COMMAND}" == "unsethook" ]; then
unsethook
elif [ "${COMMAND}" == "adjust" ]; then
checkConfig && adjust
elif [ "${COMMAND}" == "info" ]; then
Expand Down

0 comments on commit 9ca8cfb

Please sign in to comment.