setup: stop using `the_repository` in `verify_non_filename()`

Stop using `the_repository` in `verify_non_filename()` and instead accept the repository as a parameter. The injection of `the_repository` is thus bumped one level higher, where callers now pass it in explicitly. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed May 19, 2026 at 11:52 UTC 920dba458188c41b4c2d354101c662bfedf6fe02
6 files changed +8 -8
builtin/checkout.c
+1 -1
@@ -1484,7 +1484,7 @@ static int parse_branchname_arg(int argc, const char **argv,
1484 * it would be extremely annoying.
1485 */
1486 if (argc)
1487 - verify_non_filename(opts->prefix, arg);
1487 + verify_non_filename(the_repository, opts->prefix, arg);
1488 } else if (opts->accept_pathspec) {
1489 argcount++;
1490 argv++;
builtin/grep.c
+1 -1
@@ -1151,7 +1151,7 @@ int cmd_grep(int argc,
1151
1152 object = parse_object_or_die(the_repository, &oid, arg);
1153 if (!seen_dashdash)
1154 - verify_non_filename(prefix, arg);
1154 + verify_non_filename(the_repository, prefix, arg);
1155 add_object_array_with_path(object, arg, &list, oc.mode, oc.path);
1156 object_context_release(&oc);
1157 }
builtin/reset.c
+1 -1
@@ -281,7 +281,7 @@ static void parse_args(struct pathspec *pathspec,
281 * Ok, argv[0] looks like a commit/tree; it should not
282 * be a filename.
283 */
284 - verify_non_filename(prefix, argv[0]);
284 + verify_non_filename(the_repository, prefix, argv[0]);
285 rev = *argv++;
286 } else {
287 /* Otherwise we treat this as a filename */
revision.c
+2 -2
@@ -2072,7 +2072,7 @@ static int handle_dotdot_1(const char *a_name, const char *b_name,
2072 return -1;
2073
2074 if (!cant_be_filename) {
2075 - verify_non_filename(revs->prefix, full_name);
2075 + verify_non_filename(the_repository, revs->prefix, full_name);
2076 }
2077
2078 a_obj = parse_object(revs->repo, &a_oid);
@@ -2225,7 +2225,7 @@ static int handle_revision_arg_1(const char *arg_, struct rev_info *revs, int fl
2225 goto out;
2226 }
2227 if (!cant_be_filename)
2228 - verify_non_filename(revs->prefix, arg);
2228 + verify_non_filename(the_repository, revs->prefix, arg);
2229 object = get_reference(revs, arg, &oid, flags ^ local_flags);
2230 if (!object) {
2231 ret = (revs->ignore_missing || revs->do_not_die_on_missing_objects) ? 0 : -1;
setup.c
+2 -2
@@ -297,9 +297,9 @@ void verify_filename(struct repository *repo,
297 * and we parsed the arg as a refname. It should not be interpretable
298 * as a filename.
299 */
300 -void verify_non_filename(const char *prefix, const char *arg)
300 +void verify_non_filename(struct repository *repo, const char *prefix, const char *arg)
301 {
302 - if (!is_inside_work_tree(the_repository) || is_inside_git_dir(the_repository))
302 + if (!is_inside_work_tree(repo) || is_inside_git_dir(repo))
303 return;
304 if (*arg == '-')
305 return; /* flag */
setup.h
+1 -1
@@ -146,7 +146,7 @@ void verify_filename(struct repository *repo,
146 const char *prefix,
147 const char *name,
148 int diagnose_misspelt_rev);
149 -void verify_non_filename(const char *prefix, const char *name);
149 +void verify_non_filename(struct repository *repo, const char *prefix, const char *name);
150 int path_inside_repo(struct repository *repo, const char *prefix, const char *path);
151
152 void sanitize_stdfds(void);