diff options
| author | Stefan Beller <sbeller@google.com> | 2018-05-17 15:51:46 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-05-18 08:13:10 +0900 |
| commit | c88134870e8b2da084e37fb86ff88fb7d7617d61 (patch) | |
| tree | ccc6e0b810e3e986d69652538b05dfe24c0c0a35 /builtin | |
| parent | 22bdc7c4ff28452283c150b627ed12a6ee370532 (diff) | |
| download | git-c88134870e8b2da084e37fb86ff88fb7d7617d61.tar.xz | |
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 'builtin')
| -rw-r--r-- | builtin/fetch.c | 2 | ||||
| -rw-r--r-- | builtin/pack-objects.c | 4 | ||||
| -rw-r--r-- | builtin/prune.c | 2 | ||||
| -rw-r--r-- | builtin/rev-parse.c | 3 |
4 files changed, 6 insertions, 5 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index c1f2df9796..55140671ef 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1445,7 +1445,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) if (unshallow) { if (depth) die(_("--depth and --unshallow cannot be used together")); - else if (!is_repository_shallow()) + else if (!is_repository_shallow(the_repository)) die(_("--unshallow on a complete repository does not make sense")); else depth = xstrfmt("%d", INFINITE_DEPTH); diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 97a5963efb..0f1eec2eec 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -2857,7 +2857,7 @@ static void get_object_list(int ac, const char **av) setup_revisions(ac, av, &revs, NULL); /* make sure shallows are read */ - is_repository_shallow(); + is_repository_shallow(the_repository); while (fgets(line, sizeof(line), stdin) != NULL) { int len = strlen(line); @@ -3142,7 +3142,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) use_bitmap_index = use_bitmap_index_default; /* "hard" reasons not to use bitmaps; these just won't work at all */ - if (!use_internal_rev_list || (!pack_to_stdout && write_bitmap_index) || is_repository_shallow()) + if (!use_internal_rev_list || (!pack_to_stdout && write_bitmap_index) || is_repository_shallow(the_repository)) use_bitmap_index = 0; if (pack_to_stdout || !rev_list_all) diff --git a/builtin/prune.c b/builtin/prune.c index 8cc8659612..70ec35aa05 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -160,7 +160,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix) remove_temporary_files(s); free(s); - if (is_repository_shallow()) + if (is_repository_shallow(the_repository)) prune_shallow(show_only); return 0; diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index 36b2087782..a8a9b506ff 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -879,7 +879,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) continue; } if (!strcmp(arg, "--is-shallow-repository")) { - printf("%s\n", is_repository_shallow() ? "true" + printf("%s\n", + is_repository_shallow(the_repository) ? "true" : "false"); continue; } |
