From: Johannes Schindelin Date: Wed, 10 Apr 2024 20:10:06 +0000 (+0200) Subject: Sync with 2.43.4 X-Git-Tag: v2.44.1~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e5e6663e69e4fddcf10f69fc4278632482e1889a;p=thirdparty%2Fgit.git Sync with 2.43.4 * maint-2.43: (40 commits) Git 2.43.4 Git 2.42.2 Git 2.41.1 Git 2.40.2 Git 2.39.4 fsck: warn about symlink pointing inside a gitdir core.hooksPath: add some protection while cloning init.templateDir: consider this config setting protected clone: prevent hooks from running during a clone Add a helper function to compare file contents init: refactor the template directory discovery into its own function find_hook(): refactor the `STRIP_EXTENSION` logic clone: when symbolic links collide with directories, keep the latter entry: report more colliding paths t5510: verify that D/F confusion cannot lead to an RCE submodule: require the submodule path to contain directories only clone_submodule: avoid using `access()` on directories submodules: submodule paths must not contain symlinks clone: prevent clashing git dirs when cloning submodule in parallel t7423: add tests for symlinked submodule directories ... --- e5e6663e69e4fddcf10f69fc4278632482e1889a diff --cc builtin/clone.c index bad1b70ce8,85ee7da1fa..4933771822 --- a/builtin/clone.c +++ b/builtin/clone.c @@@ -934,8 -960,9 +963,10 @@@ int cmd_clone(int argc, const char **ar int submodule_progress; int filter_submodules = 0; int hash_algo; + unsigned int ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN; const int do_not_override_repo_unix_permissions = -1; + const char *template_dir; + char *template_dir_dup = NULL; struct transport_ls_refs_options transport_ls_refs_options = TRANSPORT_LS_REFS_OPTIONS_INIT; @@@ -1110,15 -1138,8 +1148,15 @@@ } } - init_db(git_dir, real_git_dir, template_dir, GIT_HASH_UNKNOWN, NULL, - do_not_override_repo_unix_permissions, INIT_DB_QUIET); + /* + * Initialize the repository, but skip initializing the reference + * database. We do not yet know about the object format of the + * repository, and reference backends may persist that information into + * their on-disk data structures. + */ - init_db(git_dir, real_git_dir, option_template, GIT_HASH_UNKNOWN, ++ init_db(git_dir, real_git_dir, template_dir, GIT_HASH_UNKNOWN, + ref_storage_format, NULL, + do_not_override_repo_unix_permissions, INIT_DB_QUIET | INIT_DB_SKIP_REFDB); if (real_git_dir) { free((char *)git_dir); diff --cc setup.c index b69b1cbc2a,a4de5c7b5a..76a7b1f7c2 --- a/setup.c +++ b/setup.c @@@ -1967,9 -1963,10 +2033,8 @@@ static int create_default_files(const c struct stat st1; struct strbuf buf = STRBUF_INIT; char *path; - char junk[2]; int reinit; int filemode; - const char *init_template_dir = NULL; - struct strbuf err = STRBUF_INIT; const char *work_tree = get_git_work_tree(); /* diff --cc setup.h index 3599aec93c,01a6ad7735..3ba2608764 --- a/setup.h +++ b/setup.h @@@ -171,9 -181,10 +183,11 @@@ int verify_repository_format(const stru */ void check_repository_format(struct repository_format *fmt); + const char *get_template_dir(const char *option_template); + -#define INIT_DB_QUIET 0x0001 -#define INIT_DB_EXIST_OK 0x0002 +#define INIT_DB_QUIET (1 << 0) +#define INIT_DB_EXIST_OK (1 << 1) +#define INIT_DB_SKIP_REFDB (1 << 2) int init_db(const char *git_dir, const char *real_git_dir, const char *template_dir, int hash_algo,