diff options
author | Stefan Beller <sbeller@google.com> | 2018-05-17 15:51:51 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-18 08:13:10 +0900 |
commit | 102de880d24fe66a8916e7c984e5bf8db6be047c (patch) | |
tree | 0368ad2a280ca777b8edf01e77fb0ed1258c8c32 /shallow.c | |
parent | cache: convert get_graft_file to handle arbitrary repositories (diff) | |
download | tgif-102de880d24fe66a8916e7c984e5bf8db6be047c.tar.xz |
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>
Diffstat (limited to 'shallow.c')
-rw-r--r-- | shallow.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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); |