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>main
parent
2c46e933fa
commit
e6a380201e
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
4
setup.c
4
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;
|
||||
|
|
|
|||
2
setup.h
2
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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue