read_packed_refs(): read references with minimal copying
commit6a9bc4034ab59a2d241151f9025c07e62178ad95
authorMichael Haggerty <mhagger@alum.mit.edu>
Mon, 25 Sep 2017 08:00:05 +0000 (25 10:00 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Sep 2017 09:02:45 +0000 (25 18:02 +0900)
tree61151ba0ac5a51c66a298dfd58e14d5e141e94a8
parenta8811695e30e48bec0aeefe6a01ed291fd68640b
read_packed_refs(): read references with minimal copying

Instead of copying data from the `packed-refs` file one line at time
and then processing it, process the data in place as much as possible.

Also, instead of processing one line per iteration of the main loop,
process a reference line plus its corresponding peeled line (if
present) together.

Note that this change slightly tightens up the parsing of the
`packed-refs` file. Previously, the parser would have accepted
multiple "peeled" lines for a single reference (ignoring all but the
last one). Now it would reject that.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/packed-backend.c