summaryrefslogtreecommitdiff
path: root/shallow.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2018-05-17 22:51:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-17 23:13:10 (GMT)
commit22bdc7c4ff28452283c150b627ed12a6ee370532 (patch)
tree311d86fee22bb77ff8a3da7223ab5be65b079781 /shallow.c
parent19143f139d5a1a821d9d066da5d1c136a53ed803 (diff)
downloadgit-22bdc7c4ff28452283c150b627ed12a6ee370532.zip
git-22bdc7c4ff28452283c150b627ed12a6ee370532.tar.gz
git-22bdc7c4ff28452283c150b627ed12a6ee370532.tar.bz2
shallow: add repository argument to check_shallow_file_for_update
Add a repository argument to allow callers of check_shallow_file_for_update to be more specific about which repository to handle. This is a small mechanical change; it doesn't change the implementation to handle repositories other than the_repository yet. As with the previous commits, use a macro to catch callers passing a repository other than the_repository at compile time. 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.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/shallow.c b/shallow.c
index 0fadd53..0028e4e 100644
--- a/shallow.c
+++ b/shallow.c
@@ -217,7 +217,8 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,
return result;
}
-static void check_shallow_file_for_update(void)
+#define check_shallow_file_for_update(r) check_shallow_file_for_update_##r()
+static void check_shallow_file_for_update_the_repository(void)
{
if (is_shallow == -1)
die("BUG: shallow must be initialized by now");
@@ -319,7 +320,7 @@ void setup_alternate_shallow(struct lock_file *shallow_lock,
fd = hold_lock_file_for_update(shallow_lock, git_path_shallow(),
LOCK_DIE_ON_ERROR);
- check_shallow_file_for_update();
+ check_shallow_file_for_update(the_repository);
if (write_shallow_commits(&sb, 0, extra)) {
if (write_in_full(fd, sb.buf, sb.len) < 0)
die_errno("failed to write to %s",
@@ -366,7 +367,7 @@ void prune_shallow(int show_only)
}
fd = hold_lock_file_for_update(&shallow_lock, git_path_shallow(),
LOCK_DIE_ON_ERROR);
- check_shallow_file_for_update();
+ check_shallow_file_for_update(the_repository);
if (write_shallow_commits_1(&sb, 0, NULL, SEEN_ONLY)) {
if (write_in_full(fd, sb.buf, sb.len) < 0)
die_errno("failed to write to %s",