summaryrefslogtreecommitdiff
path: root/shallow.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2018-05-17 22:51:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-17 23:13:10 (GMT)
commitc88134870e8b2da084e37fb86ff88fb7d7617d61 (patch)
treeccc6e0b810e3e986d69652538b05dfe24c0c0a35 /shallow.c
parent22bdc7c4ff28452283c150b627ed12a6ee370532 (diff)
downloadgit-c88134870e8b2da084e37fb86ff88fb7d7617d61.zip
git-c88134870e8b2da084e37fb86ff88fb7d7617d61.tar.gz
git-c88134870e8b2da084e37fb86ff88fb7d7617d61.tar.bz2
shallow: add repository argument to is_repository_shallow
Add a repository argument to allow callers of is_repository_shallow 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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/shallow.c b/shallow.c
index 0028e4e..e903651 100644
--- a/shallow.c
+++ b/shallow.c
@@ -42,7 +42,7 @@ int register_shallow_the_repository(const struct object_id *oid)
return register_commit_graft(the_repository, graft, 0);
}
-int is_repository_shallow(void)
+int is_repository_shallow_the_repository(void)
{
FILE *fp;
char buf[1024];
@@ -108,7 +108,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
parse_commit_or_die(commit);
cur_depth++;
if ((depth != INFINITE_DEPTH && cur_depth >= depth) ||
- (is_repository_shallow() && !commit->parents &&
+ (is_repository_shallow(the_repository) && !commit->parents &&
(graft = lookup_commit_graft(the_repository, &commit->object.oid)) != NULL &&
graft->nr_parent < 0)) {
commit_list_insert(commit, &result);
@@ -167,7 +167,7 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,
*/
clear_object_flags(both_flags);
- is_repository_shallow(); /* make sure shallows are read */
+ is_repository_shallow(the_repository); /* make sure shallows are read */
init_revisions(&revs, NULL);
save_commit_buffer = 0;
@@ -345,7 +345,7 @@ static int advertise_shallow_grafts_cb(const struct commit_graft *graft, void *c
void advertise_shallow_grafts(int fd)
{
- if (!is_repository_shallow())
+ if (!is_repository_shallow(the_repository))
return;
for_each_commit_graft(advertise_shallow_grafts_cb, &fd);
}