diff --git a/README.md b/README.md index c486693..03f1319 100644 --- a/README.md +++ b/README.md @@ -158,11 +158,11 @@ You should use `--no-verify` option https://bobbyhadz.com/blog/git-commit-skip-hooks#skip-git-commit-hooks -If you need to bypass hooks for multiple Git operations, setting the SIMPLE_GIT_HOOKS environment variable can be more convenient. Once set, all subsequent Git operations in the same terminal session will bypass the associated hooks. +If you need to bypass hooks for multiple Git operations, setting the SKIP_SIMPLE_GIT_HOOKS environment variable can be more convenient. Once set, all subsequent Git operations in the same terminal session will bypass the associated hooks. ```sh # Set the environment variable -export SIMPLE_GIT_HOOKS=0 +export SKIP_SIMPLE_GIT_HOOKS=1 # Subsequent Git commands will skip the hooks git add . diff --git a/simple-git-hooks.js b/simple-git-hooks.js index e18d0a9..65db7f1 100644 --- a/simple-git-hooks.js +++ b/simple-git-hooks.js @@ -36,8 +36,8 @@ const VALID_OPTIONS = ['preserveUnused'] const PREPEND_SCRIPT = "#!/bin/sh\n\n" + - 'if [ "$SIMPLE_GIT_HOOKS" = "0" ]; then\n' + - ' echo "[INFO] SIMPLE_GIT_HOOKS is set to 0, skipping hook."\n' + + 'if [ "$SKIP_SIMPLE_GIT_HOOKS" = "1" ]; then\n' + + ' echo "[INFO] SKIP_SIMPLE_GIT_HOOKS is set to 1, skipping hook."\n' + " exit 0\n" + "fi\n\n"; diff --git a/simple-git-hooks.test.js b/simple-git-hooks.test.js index b38880b..b0003be 100644 --- a/simple-git-hooks.test.js +++ b/simple-git-hooks.test.js @@ -143,7 +143,7 @@ afterEach(() => { projectWithUnusedConfigurationInPackageJsonPath, projectWithCustomConfigurationFilePath, ].forEach((testCase) => { - delete process.env.SIMPLE_GIT_HOOKS; + delete process.env.SKIP_SIMPLE_GIT_HOOKS; removeGitHooksFolder(testCase); }); }); @@ -295,7 +295,7 @@ test.each([ }) -test("bypasses hooks when SIMPLE_GIT_HOOKS is set to 0", () => { +test("bypasses hooks when SKIP_SIMPLE_GIT_HOOKS is set to 1", () => { execSync("git init \ && git config user.name github-actions \ && git config user.email github-actions@github.com", { cwd: projectWithConfigurationInPackageJsonPath }); @@ -303,7 +303,7 @@ test("bypasses hooks when SIMPLE_GIT_HOOKS is set to 0", () => { createGitHooksFolder(projectWithConfigurationInPackageJsonPath); spc.setHooksFromConfig(projectWithConfigurationInPackageJsonPath); - process.env.SIMPLE_GIT_HOOKS = '0'; // Set environment variable + process.env.SKIP_SIMPLE_GIT_HOOKS = '1'; // Set environment variable let errorOccured = false; try { execSync('git add . && git commit --allow-empty -m "Test commit" && git commit --allow-empty -am "Change commit msg"', {