summaryrefslogtreecommitdiff
path: root/builtin/pack-objects.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-08-12 04:34:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-08-12 19:17:19 (GMT)
commitf7f91086a376ba53f8270ea80b7bbbd8274c3c2d (patch)
tree37490af7d286faf5b7e5c1d7c0f8e3f05f24e456 /builtin/pack-objects.c
parent967f8c918465312cc6cc1bcbcfacafcf95152bd8 (diff)
downloadgit-f7f91086a376ba53f8270ea80b7bbbd8274c3c2d.zip
git-f7f91086a376ba53f8270ea80b7bbbd8274c3c2d.tar.gz
git-f7f91086a376ba53f8270ea80b7bbbd8274c3c2d.tar.bz2
pack-objects: turn off bitmaps when we see --shallow lines
Reachability bitmaps do not work with shallow operations, because they cache a view of the object reachability that represents the true objects. Whereas a shallow repository (or a shallow operation in a repository) is inherently cutting off the object graph with a graft. We explicitly disallow the use of bitmaps in shallow repositories by checking is_repository_shallow(), and we should continue to do that. However, we also want to disallow bitmaps when we are serving a fetch to a shallow client, since we momentarily take on their grafted view of the world. It used to be enough to call is_repository_shallow at the start of pack-objects. Upload-pack wrote the other side's shallow state to a temporary file and pointed the whole pack-objects process at this state with "git --shallow-file", and from the perspective of pack-objects, we really were in a shallow repo. But since b790e0f (upload-pack: send shallow info over stdin to pack-objects, 2014-03-11), we do it differently: we send --shallow lines to pack-objects over stdin, and it registers them itself. This means that our is_repository_shallow check is way too early (we have not been told about the shallowness yet), and that it is insufficient (calling is_repository_shallow is not enough, as the shallow grafts we register do not change its return value). Instead, we can just turn off bitmaps explicitly when we see these lines. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/pack-objects.c')
-rw-r--r--builtin/pack-objects.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index de36c60..2c60ddf 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -2498,6 +2498,7 @@ static void get_object_list(int ac, const char **av)
if (get_sha1_hex(line + 10, sha1))
die("not an SHA-1 '%s'", line + 10);
register_shallow(sha1);
+ use_bitmap_index = 0;
continue;
}
die("not a rev '%s'", line);