[PATCH 05/18] setup: stop using `the_repository` in `path_inside_repo()`
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Apr 20, 2026, 08:22 UTC
- Message-ID
- <20260420-pks-setup-wo-the-repository-v1-5-f4a81c4988e8@pks.im>
- In-Reply-To
- <20260420-pks-setup-wo-the-repository-v1-0-f4a81c4988e8@pks.im>
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> --- builtin/diff.c | 4 ++-- setup.c | 4 ++-- setup.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/builtin/diff.c b/builtin/diff.c index 0b23c41456..7ddebce2ac 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -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; } diff --git a/setup.c b/setup.c index 331ea86a40..6cfb05c527 100644 --- a/setup.c +++ b/setup.c @@ -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; diff --git a/setup.h b/setup.h index 24034572b1..c3247d7fc8 100644 --- a/setup.h +++ b/setup.h @@ -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);
-- 2.54.0.rc2.529.gd9106f7525.dirty