Skip to content

Commit 22bdc7c

Browse files
stefanbellergitster
authored andcommitted
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>
1 parent 19143f1 commit 22bdc7c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

shallow.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,
217217
return result;
218218
}
219219

220-
static void check_shallow_file_for_update(void)
220+
#define check_shallow_file_for_update(r) check_shallow_file_for_update_##r()
221+
static void check_shallow_file_for_update_the_repository(void)
221222
{
222223
if (is_shallow == -1)
223224
die("BUG: shallow must be initialized by now");
@@ -319,7 +320,7 @@ void setup_alternate_shallow(struct lock_file *shallow_lock,
319320

320321
fd = hold_lock_file_for_update(shallow_lock, git_path_shallow(),
321322
LOCK_DIE_ON_ERROR);
322-
check_shallow_file_for_update();
323+
check_shallow_file_for_update(the_repository);
323324
if (write_shallow_commits(&sb, 0, extra)) {
324325
if (write_in_full(fd, sb.buf, sb.len) < 0)
325326
die_errno("failed to write to %s",
@@ -366,7 +367,7 @@ void prune_shallow(int show_only)
366367
}
367368
fd = hold_lock_file_for_update(&shallow_lock, git_path_shallow(),
368369
LOCK_DIE_ON_ERROR);
369-
check_shallow_file_for_update();
370+
check_shallow_file_for_update(the_repository);
370371
if (write_shallow_commits_1(&sb, 0, NULL, SEEN_ONLY)) {
371372
if (write_in_full(fd, sb.buf, sb.len) < 0)
372373
die_errno("failed to write to %s",

0 commit comments

Comments
 (0)