Re: [PATCH 5/8] hook(clone protections): add escape hatch
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 18, 2024, 00:21 UTC
- Message-ID
- <xmqqseygc6lb.fsf@gitster.g>
- In-Reply-To
- <a4f5eeef6677462267d1dbf4b2b58d30aa013684.1715987756.git.gitgitgadget@gmail.com>
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 12 quoted lines
> +static int is_hook_safe_during_clone(const char *name, const char *path, char *sha256)
> +{
> + if (get_sha256_of_file_contents(path, sha256) < 0)
> + return 0;
> +
> + if (!safe_hook_sha256s_initialized) {
> + safe_hook_sha256s_initialized = 1;
> + git_protected_config(safe_hook_cb, &safe_hook_sha256s);
> + }
> +
> + return strset_contains(&safe_hook_sha256s, sha256);
> +}Makes sense. Use of a hashmap/strset here makes sense.