setup: stop using `the_repository` in `path_inside_repo()`
Stop using `the_repository` in `path_inside_repo()` 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
e6a380201e841b4e4aa0a7b9c1b65330cc90377f
3 files changed
+5
-5
builtin/diff.c
+2
-2
@@ -471,8 +471,8 @@ int cmd_diff(int argc,
471
* as a colourful "diff" replacement.
472
*/
473
if (nongit || ((argc == i + 2) &&
474
- (!path_inside_repo(prefix, argv[i]) ||
475
- !path_inside_repo(prefix, argv[i + 1]))))
474
+ (!path_inside_repo(the_repository, prefix, argv[i]) ||
475
+ !path_inside_repo(the_repository, prefix, argv[i + 1]))))
476
no_index = DIFF_NO_INDEX_IMPLICIT;
477
}
478
setup.c
+2
-2
@@ -160,10 +160,10 @@ char *prefix_path(struct repository *repo, const char *prefix, int len, const ch
160
return r;
161
}
162
163
-int path_inside_repo(const char *prefix, const char *path)
163
+int path_inside_repo(struct repository *repo, const char *prefix, const char *path)
164
{
165
int len = prefix ? strlen(prefix) : 0;
166
- char *r = prefix_path_gently(the_repository, prefix, len, NULL, path);
166
+ char *r = prefix_path_gently(repo, prefix, len, NULL, path);
167
if (r) {
168
free(r);
169
return 1;
setup.h
+1
-1
@@ -146,7 +146,7 @@ void verify_filename(const char *prefix,
146
const char *name,
147
int diagnose_misspelt_rev);
148
void verify_non_filename(const char *prefix, const char *name);
149
-int path_inside_repo(const char *prefix, const char *path);
149
+int path_inside_repo(struct repository *repo, const char *prefix, const char *path);
150
151
void sanitize_stdfds(void);
152
int daemonize(void);