]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jk/upload-pack-v2-capability-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Thu, 7 Mar 2024 23:59:42 +0000 (15:59 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Mar 2024 23:59:42 +0000 (15:59 -0800)
The upload-pack program, when talking over v2, accepted the
packfile-uris protocol extension from the client, even if it did
not advertise the capability, which has been corrected.

* jk/upload-pack-v2-capability-cleanup:
  upload-pack: only accept packfile-uris if we advertised it
  upload-pack: use existing config mechanism for advertisement
  upload-pack: centralize setup of sideband-all config
  upload-pack: use repository struct to get config

1  2 
upload-pack.c

diff --cc upload-pack.c
index 281bdf85c936d5d4a5e6615ee624359b137fe730,66f4de9d8723a088e02232ee3723fa0758cd6af7..902144b9d3470b9a603a584f7f4207511b15dc2b
@@@ -113,7 -113,7 +113,8 @@@ struct upload_pack_data 
        unsigned done : 1;                                      /* v2 only */
        unsigned allow_ref_in_want : 1;                         /* v2 only */
        unsigned allow_sideband_all : 1;                        /* v2 only */
 +      unsigned seen_haves : 1;                                /* v2 only */
+       unsigned allow_packfile_uris : 1;                       /* v2 only */
        unsigned advertise_sid : 1;
        unsigned sent_capabilities : 1;
  };
@@@ -1648,10 -1651,8 +1654,11 @@@ static void process_args(struct packet_
                        continue;
                }
  
-               if (skip_prefix(arg, "packfile-uris ", &p)) {
+               if (data->allow_packfile_uris &&
+                   skip_prefix(arg, "packfile-uris ", &p)) {
 +                      if (data->uri_protocols.nr)
 +                              send_err_and_die(data,
 +                                               "multiple packfile-uris lines forbidden");
                        string_list_split(&data->uri_protocols, p, ',', -1);
                        continue;
                }