aboutsummaryrefslogtreecommitdiffstats
path: root/hook.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-05-24 12:29:35 -0700
committerJunio C Hamano <gitster@pobox.com>2024-05-24 12:29:36 -0700
commit48440f60a730b93b2a39449a69cb56db5e7114c7 (patch)
tree6547cae6f0c29cd3a8be08c3abb2e004b8fae3de /hook.c
parentGit 2.40.2 (diff)
parentRevert "fsck: warn about symlink pointing inside a gitdir" (diff)
downloadgit-48440f60a730b93b2a39449a69cb56db5e7114c7.tar.gz
git-48440f60a730b93b2a39449a69cb56db5e7114c7.zip
Merge branch 'jc/fix-2.45.1-and-friends-for-2.39' into fixes/2.45.1/2.40
Revert overly aggressive "layered defence" that went into 2.45.1 and friends, which broke "git-lfs", "git-annex", and other use cases, so that we can rebuild necessary counterparts in the open. * jc/fix-2.45.1-and-friends-for-2.39: Revert "fsck: warn about symlink pointing inside a gitdir" Revert "Add a helper function to compare file contents" clone: drop the protections where hooks aren't run tests: verify that `clone -c core.hooksPath=/dev/null` works again Revert "core.hooksPath: add some protection while cloning" init: use the correct path of the templates directory again hook: plug a new memory leak ci: stop installing "gcc-13" for osx-gcc ci: avoid bare "gcc" for osx-gcc job ci: drop mention of BREW_INSTALL_PACKAGES variable send-email: avoid creating more than one Term::ReadLine object send-email: drop FakeTerm hack
Diffstat (limited to 'hook.c')
-rw-r--r--hook.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/hook.c b/hook.c
index 655e2fe44e..7981e081f5 100644
--- a/hook.c
+++ b/hook.c
@@ -3,30 +3,6 @@
#include "run-command.h"
#include "config.h"
-static int identical_to_template_hook(const char *name, const char *path)
-{
- const char *env = getenv("GIT_CLONE_TEMPLATE_DIR");
- const char *template_dir = get_template_dir(env && *env ? env : NULL);
- struct strbuf template_path = STRBUF_INIT;
- int found_template_hook, ret;
-
- strbuf_addf(&template_path, "%s/hooks/%s", template_dir, name);
- found_template_hook = access(template_path.buf, X_OK) >= 0;
-#ifdef STRIP_EXTENSION
- if (!found_template_hook) {
- strbuf_addstr(&template_path, STRIP_EXTENSION);
- found_template_hook = access(template_path.buf, X_OK) >= 0;
- }
-#endif
- if (!found_template_hook)
- return 0;
-
- ret = do_files_match(template_path.buf, path);
-
- strbuf_release(&template_path);
- return ret;
-}
-
const char *find_hook(const char *name)
{
static struct strbuf path = STRBUF_INIT;
@@ -62,14 +38,6 @@ const char *find_hook(const char *name)
}
return NULL;
}
- if (!git_hooks_path && git_env_bool("GIT_CLONE_PROTECTION_ACTIVE", 0) &&
- !identical_to_template_hook(name, path.buf))
- die(_("active `%s` hook found during `git clone`:\n\t%s\n"
- "For security reasons, this is disallowed by default.\n"
- "If this is intentional and the hook should actually "
- "be run, please\nrun the command again with "
- "`GIT_CLONE_PROTECTION_ACTIVE=false`"),
- name, path.buf);
return path.buf;
}