]> git.ipfire.org Git - thirdparty/git.git/commit
upload-pack: clear filter_options for each v2 fetch command
authorChristian Couder <christian.couder@gmail.com>
Fri, 8 May 2020 08:01:15 +0000 (10:01 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 May 2020 18:07:27 +0000 (11:07 -0700)
commit08450ef7918ef2f24bc3bf6afcd1782aa0677015
tree76be7d1f0f210be794103425ebb739ed5fef9f60
parent274b9cc25322d9ee79aa8e6d4e86f0ffe5ced925
upload-pack: clear filter_options for each v2 fetch command

Because of the request/response model of protocol v2, the
upload_pack_v2() function is sometimes called twice in the same
process, while 'struct list_objects_filter_options filter_options'
was declared as static at the beginning of 'upload-pack.c'.

This made the check in list_objects_filter_die_if_populated(), which
is called by process_args(), fail the second time upload_pack_v2() is
called, as filter_options had already been populated the first time.

To fix that, filter_options is not static any more. It's now owned
directly by upload_pack(). It's now also part of 'struct
upload_pack_data', so that it's owned indirectly by upload_pack_v2().

In the long term, the goal is to also have upload_pack() use
'struct upload_pack_data', so adding filter_options to this struct
makes more sense than to have it owned directly by upload_pack_v2().

This fixes the first of the 2 bugs documented by d0badf8797
(partial-clone: demonstrate bugs in partial fetch, 2020-02-21).

Helped-by: Derrick Stolee <dstolee@microsoft.com>
Helped-by: Jeff King <peff@peff.net>
Helped-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5616-partial-clone.sh
upload-pack.c