pack-refs: write peeled entry for non-tags
commit03a8eddfd1bd7cdce0b2361753691f53c00e5ba6
authorJeff King <peff@peff.net>
Sun, 17 Mar 2013 08:23:46 +0000 (17 04:23 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sun, 17 Mar 2013 19:52:20 +0000 (17 12:52 -0700)
tree4b18041cc83738ff0a0e3d21d17e423cdf06553f
parentf7892d181752187513f10b13f2272fa46c9c8422
pack-refs: write peeled entry for non-tags

When we pack an annotated tag ref, we write not only the
sha1 of the tag object along with the ref, but also the sha1
obtained by peeling the tag. This lets readers of the
pack-refs file know the peeled value without having to
actually load the object, speeding up upload-pack's ref
advertisement.

The writer marks a packed-refs file with peeled refs using
the "peeled" trait at the top of the file. When the reader
sees this trait, it knows that each ref is either followed
by its peeled value, or it is not an annotated tag.

However, there is a mismatch between the assumptions of the
reader and writer. The writer will only peel refs under
refs/tags, but the reader does not know this; it will assume
a ref without a peeled value must not be a tag object. Thus
an annotated tag object placed outside of the refs/tags
hierarchy will not have its peeled value printed by
upload-pack.

The simplest way to fix this is to start writing peel values
for all refs. This matches what the reader expects for both
new and old versions of git.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pack-refs.c
t/t3211-peel-ref.sh [new file with mode: 0755]