summaryrefslogtreecommitdiff
path: root/upload-pack.c
AgeCommit message (Collapse)AuthorFilesLines
2020-07-06Merge branch 'bc/sha-256-part-2'Libravatar Junio C Hamano1-1/+2
SHA-256 migration work continues. * bc/sha-256-part-2: (44 commits) remote-testgit: adapt for object-format bundle: detect hash algorithm when reading refs t5300: pass --object-format to git index-pack t5704: send object-format capability with SHA-256 t5703: use object-format serve option t5702: offer an object-format capability in the test t/helper: initialize the repository for test-sha1-array remote-curl: avoid truncating refs with ls-remote t1050: pass algorithm to index-pack when outside repo builtin/index-pack: add option to specify hash algorithm remote-curl: detect algorithm for dumb HTTP by size builtin/ls-remote: initialize repository based on fetch t5500: make hash independent serve: advertise object-format capability for protocol v2 connect: parse v2 refs with correct hash algorithm connect: pass full packet reader when parsing v2 refs Documentation/technical: document object-format for protocol v2 t1302: expect repo format version 1 for SHA-256 builtin/show-index: provide options to determine hash algo t5302: modernize test formatting ...
2020-06-25Merge branch 'jt/cdn-offload'Libravatar Junio C Hamano1-39/+117
The "fetch/clone" protocol has been updated to allow the server to instruct the clients to grab pre-packaged packfile(s) in addition to the packed object data coming over the wire. * jt/cdn-offload: upload-pack: fix a sparse '0 as NULL pointer' warning upload-pack: send part of packfile response as uri fetch-pack: support more than one pack lockfile upload-pack: refactor reading of pack-objects out Documentation: add Packfile URIs design doc Documentation: order protocol v2 sections http-fetch: support fetching packfiles by URL http-fetch: refactor into function http: refactor finish_http_pack_request() http: use --stdin when indexing dumb HTTP pack
2020-06-17upload-pack: fix a sparse '0 as NULL pointer' warningLibravatar Ramsay Jones1-1/+1
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-11upload-pack: refactor common code into do_got_oid()Libravatar Christian Couder1-30/+13
As 'upload-pack.c' is now using 'struct upload_pack_data' thoroughly, let's refactor some common code into a new do_got_oid() function. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-11upload-pack: move oldest_have to upload_pack_dataLibravatar Christian Couder1-7/+6
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the 'oldest_have' static variable into this struct. It is used by both protocol v0 and protocol v2 code. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-11upload-pack: pass upload_pack_data to got_oid()Libravatar Christian Couder1-4/+4
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to got_oid(), so that this function can use all the fields of the struct. This will be used in followup commits to move a static variable into 'upload_pack_data'. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-11upload-pack: pass upload_pack_data to ok_to_give_up()Libravatar Christian Couder1-7/+6
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to ok_to_give_up(), so that this function can use all the fields of the struct. This will be used in followup commits to move a static variable into 'upload_pack_data'. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-11upload-pack: pass upload_pack_data to send_acks()Libravatar Christian Couder1-10/+7
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to send_acks(), so that this function can use all the fields of the struct. This will be used in followup commits to move a static variable into 'upload_pack_data'. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-11upload-pack: pass upload_pack_data to process_haves()Libravatar Christian Couder1-6/+5
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to process_haves(), so that this function can use all the fields of the struct. This will be used in followup commits to move a static variable into 'upload_pack_data'. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-11upload-pack: change allow_unadvertised_object_request to an enumLibravatar Christian Couder1-36/+32
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's change allow_unadvertised_object_request, which is now part of 'upload_pack_data', from an 'unsigned int' to an enum. This will make it clear which values this variable can take. While at it let's change this variable name to 'allow_uor' to make it shorter. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-11upload-pack: move allow_unadvertised_object_request to upload_pack_dataLibravatar Christian Couder1-23/+32
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the 'allow_unadvertised_object_request' static variable into this struct. It is used by code common to protocol v0 and protocol v2. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-11upload-pack: move extra_edge_obj to upload_pack_dataLibravatar Christian Couder1-4/+7
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the 'extra_edge_obj' static variable into this struct. It is used by code common to protocol v0 and protocol v2. While at it let's properly initialize and clear 'extra_edge_obj' in the appropriate 'upload_pack_data' initialization and clearing functions. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-11upload-pack: move shallow_nr to upload_pack_dataLibravatar Christian Couder1-12/+12
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the 'shallow_nr' static variable into this struct. It is used by code common to protocol v0 and protocol v2. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-11upload-pack: pass upload_pack_data to send_unshallow()Libravatar Christian Couder1-9/+7
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to send_unshallow(), so that this function can use all the fields of the struct. This will be used in followup commits to move static variables into 'upload_pack_data'. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-11upload-pack: pass upload_pack_data to deepen_by_rev_list()Libravatar Christian Couder1-8/+6
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to deepen_by_rev_list(), so that this function can use all the fields of the struct. This will be used in followup commits to move static variables into 'upload_pack_data'. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-11upload-pack: pass upload_pack_data to deepen()Libravatar Christian Couder1-14/+11
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to deepen(), so that this function can use all the fields of the struct. This will be used in followup commits to move static variables into 'upload_pack_data'. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-11upload-pack: pass upload_pack_data to send_shallow_list()Libravatar Christian Couder1-36/+21
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to send_shallow_list(), so that this function can use all the fields of the struct. This will be used in followup commits to move static variables into 'upload_pack_data'. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-10upload-pack: send part of packfile response as uriLibravatar Jonathan Tan1-6/+71
Teach upload-pack to send part of its packfile response as URIs. An administrator may configure a repository with one or more "uploadpack.blobpackfileuri" lines, each line containing an OID, a pack hash, and a URI. A client may configure fetch.uriprotocols to be a comma-separated list of protocols that it is willing to use to fetch additional packfiles - this list will be sent to the server. Whenever an object with one of those OIDs would appear in the packfile transmitted by upload-pack, the server may exclude that object, and instead send the URI. The client will then download the packs referred to by those URIs before performing the connectivity check. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-10upload-pack: refactor reading of pack-objects outLibravatar Jonathan Tan1-35/+49
Subsequent patches will change how the output of pack-objects is processed, so extract that processing into its own function. Currently, at most 1 character can be buffered (in the "buffered" local variable). One of those patches will require a larger buffer, so replace that "buffered" local variable with a buffer array. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-04upload-pack: move pack_objects_hook to upload_pack_dataLibravatar Christian Couder1-4/+7
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the 'pack_objects_hook' static variable into this struct. It is used by code common to protocol v0 and protocol v2. While at it let's also free() it in upload_pack_data_clear(). Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-04upload-pack: move allow_sideband_all to upload_pack_dataLibravatar Christian Couder1-4/+3
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the 'allow_sideband_all' static variable into this struct. It is used only by protocol v2 code. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-04upload-pack: move allow_ref_in_want to upload_pack_dataLibravatar Christian Couder1-4/+3
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the 'allow_ref_in_want' static variable into this struct. It is used only by protocol v2 code. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-04upload-pack: move allow_filter to upload_pack_dataLibravatar Christian Couder1-5/+6
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the 'allow_filter' static variable into this struct. It is used by both protocol v0 and protocol v2 code. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-04upload-pack: move keepalive to upload_pack_dataLibravatar Christian Couder1-7/+14
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the 'keepalive' static variable into this struct. It is used by code common to protocol v0 and protocol v2. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-04upload-pack: pass upload_pack_data to upload_pack_config()Libravatar Christian Couder1-5/+5
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to upload_pack_config(), so that this function can use all the fields of the struct. This will be used in followup commits to move static variables that are set in upload_pack_config() into 'upload_pack_data'. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-04upload-pack: change multi_ack to an enumLibravatar Christian Couder1-6/+10
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's take this opportunity to change the 'multi_ack' variable, which is now part of 'upload_pack_data', to an enum. This will make it clear which values this variable can take. Helped-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-04upload-pack: move multi_ack to upload_pack_dataLibravatar Christian Couder1-10/+10
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the multi_ack static variable into this struct. It is only used by protocol v0 code since protocol v2 assumes certain baseline capabilities, but rolling it into upload_pack_data and just letting v2 code ignore it as it does now is more coherent and cleaner. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-04upload-pack: move filter_capability_requested to upload_pack_dataLibravatar Christian Couder1-3/+3
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the filter_capability_requested static variable into this struct. It is only used by protocol v0 code since protocol v2 assumes certain baseline capabilities, but rolling it into upload_pack_data and just letting v2 code ignore it as it does now is more coherent and cleaner. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-04upload-pack: move use_sideband to upload_pack_dataLibravatar Christian Couder1-15/+19
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the 'use_sideband' static variable into this struct. This variable is used by both v0 and v2 protocols. While at it, let's update the comment near the variable definition. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-04upload-pack: move static vars to upload_pack_dataLibravatar Christian Couder1-14/+14
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the 'no_done', 'daemon_mode' and 'timeout' variables into this struct. They are only used by protocol v0 code since protocol v2 assumes certain baseline capabilities, but rolling them into upload_pack_data and just letting v2 code ignore them as it does now is more coherent and cleaner. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-04upload-pack: annotate upload_pack_data fieldsLibravatar Christian Couder1-5/+10
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's annotate fields from this struct to let people know which ones are used only for protocol v0 and which ones only for protocol v2. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-04upload-pack: actually use some upload_pack_data bitfieldsLibravatar Jeff King1-15/+14
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's actually start using some bitfields of that struct. These bitfields were introduced in 3145ea957d ("upload-pack: introduce fetch server command", 2018-03-15), but were never used. We could instead have just removed the following bitfields from the struct: unsigned use_thin_pack : 1; unsigned use_ofs_delta : 1; unsigned no_progress : 1; unsigned use_include_tag : 1; but using them makes it possible to remove a number of static variables with the same name and purpose from 'upload-pack.c'. This is a behavior change, as we accidentally used to let values in those bitfields propagate from one v2 "fetch" command to another for ssh/git/file connections (but not for http). That's fixing a bug, but one nobody is likely to see, because it would imply the client sending different capabilities for each request. Helped-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-05-27remote: advertise the object-format capability on the server sideLibravatar brian m. carlson1-1/+2
Advertise the current hash algorithm in use by using the object-format capability as part of the ref advertisement. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-05-18upload-pack: use upload_pack_data fields in receive_needs()Libravatar Christian Couder1-15/+13
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's use fields from this struct in receive_needs(), instead of local variables with the same name and purpose. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-05-18upload-pack: pass upload_pack_data to create_pack_file()Libravatar Christian Couder1-15/+9
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to create_pack_file(), so that this function, and the function it calls, can use all the fields of the struct. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-05-18upload-pack: remove static variable 'stateless_rpc'Libravatar Christian Couder1-6/+7
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's remove the 'stateless_rpc' static variable, as we can now use the field of 'struct upload_pack_data' with the same name instead. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-05-18upload-pack: pass upload_pack_data to check_non_tip()Libravatar Christian Couder1-7/+6
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to check_non_tip(), so that this function and the functions it calls, can use all the fields of the struct in followup commits. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-05-18upload-pack: pass upload_pack_data to send_ref()Libravatar Christian Couder1-3/+4
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to send_ref(), so that this function, and the functions it calls, can use all the fields of the struct in followup commits. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-05-18upload-pack: move symref to upload_pack_dataLibravatar Christian Couder1-5/+7
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, we are passing around that struct to many functions, so let's also pass 'struct string_list symref' around at the same time by moving it from a local variable in upload_pack() into a field of 'struct upload_pack_data'. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-05-18upload-pack: use upload_pack_data writer in receive_needs()Libravatar Christian Couder1-5/+3
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's use the 'struct packet_writer writer' field from 'struct upload_pack_data' in receive_needs(), instead of a local 'struct packet_writer writer' variable. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-05-18upload-pack: pass upload_pack_data to receive_needs()Libravatar Christian Couder1-9/+8
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass 'struct upload_pack_data' to receive_needs(), so that this function and the functions it calls can use all the fields of that struct in followup commits. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-05-18upload-pack: pass upload_pack_data to get_common_commits()Libravatar Christian Couder1-13/+13
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass 'struct upload_pack_data' to get_common_commits(), so that this function and the functions it calls can use all the fields of that struct in followup commits. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-05-18upload-pack: use 'struct upload_pack_data' in upload_pack()Libravatar Christian Couder1-15/+17
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's use 'struct upload_pack_data' in upload_pack(). This will make it possible in followup commits to remove a lot of static variables and local variables that have the same name and purpose as fields in 'struct upload_pack_data'. This will also make upload_pack() work in a more similar way as upload_pack_v2(). Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-05-18upload-pack: move 'struct upload_pack_data' aroundLibravatar Christian Couder1-56/+56
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move 'struct upload_pack_data' and the related upload_pack_data_init() and upload_pack_data_clear() functions towards the beginning of the file, so that this struct and its related functions can then be used by upload_pack() in a followup commit. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-05-18upload-pack: move {want,have}_obj to upload_pack_dataLibravatar Christian Couder1-23/+25
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the want_obj and have_obj object arrays into 'struct upload_pack_data'. These object arrays are used by both upload_pack() and upload_pack_v2(), for example when these functions call create_pack_file(). We are going to use 'struct upload_pack_data' in upload_pack() in a followup commit. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-05-18upload-pack: remove unused 'wants' from upload_pack_dataLibravatar Christian Couder1-4/+0
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's remove 'struct object_array wants' from 'struct upload_pack_data', as it appears to be unused. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-05-13Merge branch 'cc/upload-pack-v2-fetch-fix'Libravatar Junio C Hamano1-12/+22
Serving a "git fetch" client over "git://" and "ssh://" protocols using the on-wire protocol version 2 was buggy on the server end when the client needs to make a follow-up request to e.g. auto-follow tags. * cc/upload-pack-v2-fetch-fix: upload-pack: clear filter_options for each v2 fetch command
2020-05-13Merge branch 'tb/shallow-cleanup'Libravatar Junio C Hamano1-0/+1
Code cleanup. * tb/shallow-cleanup: shallow: use struct 'shallow_lock' for additional safety shallow.h: document '{commit,rollback}_shallow_file' shallow: extract a header file for shallow-related functions commit: make 'commit_graft_pos' non-static
2020-05-08upload-pack: clear filter_options for each v2 fetch commandLibravatar Christian Couder1-12/+22
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>
2020-04-30shallow: extract a header file for shallow-related functionsLibravatar Taylor Blau1-0/+1
There are many functions in commit.h that are more related to shallow repositories than they are to any sort of generic commit machinery. Likely this began when there were only a few shallow-related functions, and commit.h seemed a reasonable enough place to put them. But, now there are a good number of shallow-related functions, and placing them all in 'commit.h' doesn't make sense. This patch extracts a 'shallow.h', which takes all of the declarations from 'commit.h' for functions which already exist in 'shallow.c'. We will bring the remaining shallow-related functions defined in 'commit.c' in a subsequent patch. For now, move only the ones that already are implemented in 'shallow.c', and update the necessary includes. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>