[PATCH 1/5] setup: rename `ensure_safe_repository()` for clarity
From: Michael Lohmann <hidden>
Date: 2025-10-13 09:42:39
Subsystem:
the rest · Maintainer:
Linus Torvalds
In addition to ownership it checks for "safe.directory" config, making the name `ensure_valid_ownership()` not expressive. This function ensures that a repository is considered to be safe. When additional options to check if a repository is considered to be safe are added, this name is more indicative of the content. Signed-off-by: Michael Lohmann <redacted> --- setup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/setup.c b/setup.c
index 7086741e6c..2c41874774 100644
--- a/setup.c
+++ b/setup.c@@ -1301,7 +1301,7 @@ static int safe_directory_cb(const char *key, const char *value, * config settings; for non-bare repositories, their worktree needs to be * added, for bare ones their git directory. */ -static int ensure_valid_ownership(const char *gitfile, +static int ensure_safe_repository(const char *gitfile, const char *worktree, const char *gitdir, struct strbuf *report) {
@@ -1339,7 +1339,7 @@ void die_upon_dubious_ownership(const char *gitfile, const char *worktree, struct strbuf report = STRBUF_INIT, quoted = STRBUF_INIT; const char *path; - if (ensure_valid_ownership(gitfile, worktree, gitdir, &report)) + if (ensure_safe_repository(gitfile, worktree, gitdir, &report)) return; strbuf_complete(&report, '\n');
@@ -1526,7 +1526,7 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir, const char *gitdir_candidate = gitdir_path ? gitdir_path : gitdirenv; - if (ensure_valid_ownership(gitfile, dir->buf, + if (ensure_safe_repository(gitfile, dir->buf, gitdir_candidate, report)) { strbuf_addstr(gitdir, gitdirenv); ret = GIT_DIR_DISCOVERED;
@@ -1554,7 +1554,7 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir, if (get_allowed_bare_repo() == ALLOWED_BARE_REPO_EXPLICIT && !is_implicit_bare_repo(dir->buf)) return GIT_DIR_DISALLOWED_BARE; - if (!ensure_valid_ownership(NULL, NULL, dir->buf, report)) + if (!ensure_safe_repository(NULL, NULL, dir->buf, report)) return GIT_DIR_INVALID_OWNERSHIP; strbuf_addstr(gitdir, "."); return GIT_DIR_BARE;
--
2.50.1 (Apple Git-155)