path.c: migrate global git_path_* to take a repository argument
Migrate all git_path_* functions that are defined in path.c to take a repository argument. Unlike other patches in this series, do not use the #define trick, as we rewrite the whole function, which is rather small. This doesn't migrate all the functions, as other builtins have their own local path functions defined using GIT_PATH_FUNC. So keep that macro around to serve the other locations. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
0437a2e365
commit
102de880d2
12
shallow.c
12
shallow.c
@ -52,7 +52,7 @@ int is_repository_shallow_the_repository(void)
|
||||
return is_shallow;
|
||||
|
||||
if (!path)
|
||||
path = git_path_shallow();
|
||||
path = git_path_shallow(the_repository);
|
||||
/*
|
||||
* fetch-pack sets '--shallow-file ""' as an indicator that no
|
||||
* shallow file should be used. We could just open it and it
|
||||
@ -223,7 +223,7 @@ static void check_shallow_file_for_update_the_repository(void)
|
||||
if (is_shallow == -1)
|
||||
die("BUG: shallow must be initialized by now");
|
||||
|
||||
if (!stat_validity_check(&shallow_stat, git_path_shallow()))
|
||||
if (!stat_validity_check(&shallow_stat, git_path_shallow(the_repository)))
|
||||
die("shallow file has changed since we read it");
|
||||
}
|
||||
|
||||
@ -318,7 +318,8 @@ void setup_alternate_shallow(struct lock_file *shallow_lock,
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
int fd;
|
||||
|
||||
fd = hold_lock_file_for_update(shallow_lock, git_path_shallow(),
|
||||
fd = hold_lock_file_for_update(shallow_lock,
|
||||
git_path_shallow(the_repository),
|
||||
LOCK_DIE_ON_ERROR);
|
||||
check_shallow_file_for_update(the_repository);
|
||||
if (write_shallow_commits(&sb, 0, extra)) {
|
||||
@ -365,7 +366,8 @@ void prune_shallow(int show_only)
|
||||
strbuf_release(&sb);
|
||||
return;
|
||||
}
|
||||
fd = hold_lock_file_for_update(&shallow_lock, git_path_shallow(),
|
||||
fd = hold_lock_file_for_update(&shallow_lock,
|
||||
git_path_shallow(the_repository),
|
||||
LOCK_DIE_ON_ERROR);
|
||||
check_shallow_file_for_update(the_repository);
|
||||
if (write_shallow_commits_1(&sb, 0, NULL, SEEN_ONLY)) {
|
||||
@ -374,7 +376,7 @@ void prune_shallow(int show_only)
|
||||
get_lock_file_path(&shallow_lock));
|
||||
commit_lock_file(&shallow_lock);
|
||||
} else {
|
||||
unlink(git_path_shallow());
|
||||
unlink(git_path_shallow(the_repository));
|
||||
rollback_lock_file(&shallow_lock);
|
||||
}
|
||||
strbuf_release(&sb);
|
||||
|
Reference in New Issue
Block a user