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>
This commit is contained in:
Patrick Steinhardt
2026-05-19 11:52:09 +02:00
committed by Junio C Hamano
parent 2c46e933fa
commit e6a380201e
3 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -471,8 +471,8 @@ int cmd_diff(int argc,
* as a colourful "diff" replacement.
*/
if (nongit || ((argc == i + 2) &&
(!path_inside_repo(prefix, argv[i]) ||
!path_inside_repo(prefix, argv[i + 1]))))
(!path_inside_repo(the_repository, prefix, argv[i]) ||
!path_inside_repo(the_repository, prefix, argv[i + 1]))))
no_index = DIFF_NO_INDEX_IMPLICIT;
}
+2 -2
View File
@@ -160,10 +160,10 @@ char *prefix_path(struct repository *repo, const char *prefix, int len, const ch
return r;
}
int path_inside_repo(const char *prefix, const char *path)
int path_inside_repo(struct repository *repo, const char *prefix, const char *path)
{
int len = prefix ? strlen(prefix) : 0;
char *r = prefix_path_gently(the_repository, prefix, len, NULL, path);
char *r = prefix_path_gently(repo, prefix, len, NULL, path);
if (r) {
free(r);
return 1;
+1 -1
View File
@@ -146,7 +146,7 @@ void verify_filename(const char *prefix,
const char *name,
int diagnose_misspelt_rev);
void verify_non_filename(const char *prefix, const char *name);
int path_inside_repo(const char *prefix, const char *path);
int path_inside_repo(struct repository *repo, const char *prefix, const char *path);
void sanitize_stdfds(void);
int daemonize(void);