From ba0ef25b4757f0e81b2fec5df3d1b9248526d4f8 Mon Sep 17 00:00:00 2001 From: lvsi <15239928381@163.com> Date: Sun, 23 Oct 2022 00:29:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9Eunhook=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E5=85=A8=E5=B1=80=E9=92=A9=E5=AD=90=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.sh b/config/config.sh index c814291..d17399e 100644 --- a/config/config.sh +++ b/config/config.sh @@ -10,4 +10,4 @@ dingToken="example" loadingSpeed=4 # the protect rules -protectMainSwitch="on" +protectMainSwitch="off" From 75e6dfbe57b2842e0470bfbb21efbf30c5477222 Mon Sep 17 00:00:00 2001 From: lvsi <15239928381@163.com> Date: Sun, 23 Oct 2022 00:31:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9Eunhook=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E5=85=A8=E5=B1=80=E9=92=A9=E5=AD=90=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++++++ include/function.sh | 5 +++++ posture | 2 ++ 3 files changed, 13 insertions(+) diff --git a/README.md b/README.md index e82d0fe..35b1626 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,12 @@ git config --global --add core.fileMode false posture sethook ``` +当需要取消全局钩子时, 执行unsethook命令即可 + +```bash +posture unsethook +``` + ### (1) checkout钩子 当使用```git checkout/git switch```命令时,会自动执行checkout钩子,如下图所示。 diff --git a/include/function.sh b/include/function.sh index 9562723..4557e59 100644 --- a/include/function.sh +++ b/include/function.sh @@ -27,6 +27,11 @@ sethook(){ # 如果个别项目不需要使用全局的Hook, 可以在项目的根目录下重新配置git hooksPath: git config core.hooksPath .git/hooks } +# 取消设置全局Hook +unsethook(){ + git config --global core.hooksPath false +} + # 检查配置 checkConfig(){ checkLang diff --git a/posture b/posture index f6d16b6..e25b38d 100755 --- a/posture +++ b/posture @@ -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