git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 10/13] upload-pack: move allow_filter to upload_pack_data

From
Christian Couder <christian.couder@gmail.com>
Date
Jun 2, 2020, 04:16 UTC
Message-ID
<20200602041657.7132-11-chriscool@tuxfamily.org>
In-Reply-To
<20200602041657.7132-1-chriscool@tuxfamily.org>

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>
---
 upload-pack.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/upload-pack.c b/upload-pack.c
index 2695b52147..538160801d 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -55,7 +55,6 @@ static int shallow_nr;
 static struct object_array extra_edge_obj;
 static const char *pack_objects_hook;
 
-static int allow_filter;
 static int allow_ref_in_want;
 
 static int allow_sideband_all;
@@ -102,6 +101,7 @@ struct upload_pack_data {
 	unsigned use_ofs_delta : 1;
 	unsigned no_progress : 1;
 	unsigned use_include_tag : 1;
+	unsigned allow_filter : 1;
 
 	unsigned done : 1;					/* v2 only */
 };
@@ -984,7 +984,8 @@ static void receive_needs(struct upload_pack_data *data,
 			data->no_progress = 1;
 		if (parse_feature_request(features, "include-tag"))
 			data->use_include_tag = 1;
-		if (allow_filter && parse_feature_request(features, "filter"))
+		if (data->allow_filter &&
+		    parse_feature_request(features, "filter"))
 			data->filter_capability_requested = 1;
 
 		o = parse_object(the_repository, &oid_buf);
@@ -1090,7 +1091,7 @@ static int send_ref(const char *refname, const struct object_id *oid,
 				     " allow-reachable-sha1-in-want" : "",
 			     data->stateless_rpc ? " no-done" : "",
 			     symref_info.buf,
-			     allow_filter ? " filter" : "",
+			     data->allow_filter ? " filter" : "",
 			     git_user_agent_sanitized());
 		strbuf_release(&symref_info);
 	} else {
@@ -1142,7 +1143,7 @@ static int upload_pack_config(const char *var, const char *value, void *cb_data)
 		if (!data->keepalive)
 			data->keepalive = -1;
 	} else if (!strcmp("uploadpack.allowfilter", var)) {
-		allow_filter = git_config_bool(var, value);
+		data->allow_filter = git_config_bool(var, value);
 	} else if (!strcmp("uploadpack.allowrefinwant", var)) {
 		allow_ref_in_want = git_config_bool(var, value);
 	} else if (!strcmp("uploadpack.allowsidebandall", var)) {
@@ -1334,7 +1335,7 @@ static void process_args(struct packet_reader *request,
 			continue;
 		}
 
-		if (allow_filter && skip_prefix(arg, "filter ", &p)) {
+		if (data->allow_filter && skip_prefix(arg, "filter ", &p)) {
 			list_objects_filter_die_if_populated(&data->filter_options);
 			parse_list_objects_filter(&data->filter_options, p);
 			continue;
-- 
2.27.0.rc0.26.g636377a2c4
Previous: Christian CouderNext: Christian Couder
Message 69 of 108 in “upload-pack: use 'struct upload_pack_data' thoroughly, part 1”
  1. 00/13 upload-pack: use 'struct upload_pack_data' thoroughly, part 1Christian Couder, May 15, 2020
  2. 01/13 upload-pack: remove unused 'wants' from upload_pack_dataChristian Couder, May 15, 2020
  3. Jeff KingMay 15, 2020
  4. 03/13 upload-pack: move 'struct upload_pack_data' aroundChristian Couder, May 15, 2020
  5. Jeff KingMay 15, 2020
  6. 02/13 upload-pack: move {want,have}_obj to upload_pack_dataChristian Couder, May 15, 2020
  7. Jeff KingMay 15, 2020
  8. 06/13 upload-pack: pass upload_pack_data to receive_needs()Christian Couder, May 15, 2020
  9. Jeff KingMay 15, 2020
  10. 04/13 upload-pack: use 'struct upload_pack_data' in upload_pack()Christian Couder, May 15, 2020
  11. Derrick StoleeMay 15, 2020
  12. Jeff KingMay 15, 2020
  13. 05/13 upload-pack: pass upload_pack_data to get_common_commits()Christian Couder, May 15, 2020
  14. Jeff KingMay 15, 2020
  15. Jeff KingMay 15, 2020
  16. 08/13 upload-pack: move symref to upload_pack_dataChristian Couder, May 15, 2020
  17. Jeff KingMay 15, 2020
  18. 07/13 upload-pack: use upload_pack_data writer in receive_needs()Christian Couder, May 15, 2020
  19. Jeff KingMay 15, 2020
  20. 09/13 upload-pack: pass upload_pack_data to send_ref()Christian Couder, May 15, 2020
  21. Jeff KingMay 15, 2020
  22. 12/13 upload-pack: pass upload_pack_data to create_pack_file()Christian Couder, May 15, 2020
  23. 13/13 upload-pack: use upload_pack_data fields in receive_needs()Christian Couder, May 15, 2020
  24. Jeff KingMay 15, 2020
  25. 11/13 upload-pack: remove static variable 'stateless_rpc'Christian Couder, May 15, 2020
  26. Jeff KingMay 15, 2020
  27. 10/13 upload-pack: pass upload_pack_data to check_non_tip()Christian Couder, May 15, 2020
  28. Derrick StoleeMay 15, 2020
  29. Christian CouderMay 19, 2020
  30. Jeff KingMay 15, 2020
  31. Jeff KingMay 15, 2020
  32. Christian CouderMay 19, 2020
  33. 00/12 upload-pack: use 'struct upload_pack_data' thoroughly, part 2Christian Couder, May 27, 2020
  34. 02/12 upload-pack: move static vars to upload_pack_dataChristian Couder, May 27, 2020
  35. Jeff KingMay 27, 2020
  36. Christian CouderJun 2, 2020
  37. 01/12 upload-pack: actually use some upload_pack_data bitfieldsChristian Couder, May 27, 2020
  38. 03/12 upload-pack: move use_sideband to upload_pack_dataChristian Couder, May 27, 2020
  39. Jeff KingMay 27, 2020
  40. 04/12 upload-pack: move filter_capability_requested to upload_pack_dataChristian Couder, May 27, 2020
  41. Jeff KingMay 27, 2020
  42. 05/12 upload-pack: move multi_ack to upload_pack_dataChristian Couder, May 27, 2020
  43. 06/12 upload-pack: change multi_ack to an enumChristian Couder, May 27, 2020
  44. Jeff KingMay 27, 2020
  45. 09/12 upload-pack: move allow_filter to upload_pack_dataChristian Couder, May 27, 2020
  46. Jeff KingMay 27, 2020
  47. 08/12 upload-pack: move keepalive to upload_pack_dataChristian Couder, May 27, 2020
  48. Jeff KingMay 27, 2020
  49. 12/12 upload-pack: move pack_objects_hook to upload_pack_dataChristian Couder, May 27, 2020
  50. Jeff KingMay 27, 2020
  51. 11/12 upload-pack: move allow_sideband_all to upload_pack_dataChristian Couder, May 27, 2020
  52. 10/12 upload-pack: move allow_ref_in_want to upload_pack_dataChristian Couder, May 27, 2020
  53. Jeff KingMay 27, 2020
  54. 07/12 upload-pack: pass upload_pack_data to upload_pack_config()Christian Couder, May 27, 2020
  55. Jeff KingMay 27, 2020
  56. Jeff KingMay 27, 2020
  57. Junio C HamanoMay 27, 2020
  58. 00/13 upload-pack: use 'struct upload_pack_data' thoroughly, part 2Christian Couder, Jun 2, 2020
  59. 01/13 upload-pack: actually use some upload_pack_data bitfieldsChristian Couder, Jun 2, 2020
  60. 02/13 upload-pack: annotate upload_pack_data fieldsChristian Couder, Jun 2, 2020
  61. 04/13 upload-pack: move use_sideband to upload_pack_dataChristian Couder, Jun 2, 2020
  62. 03/13 upload-pack: move static vars to upload_pack_dataChristian Couder, Jun 2, 2020
  63. Jeff KingJun 2, 2020
  64. 05/13 upload-pack: move filter_capability_requested to upload_pack_dataChristian Couder, Jun 2, 2020
  65. 06/13 upload-pack: move multi_ack to upload_pack_dataChristian Couder, Jun 2, 2020
  66. 08/13 upload-pack: pass upload_pack_data to upload_pack_config()Christian Couder, Jun 2, 2020
  67. 07/13 upload-pack: change multi_ack to an enumChristian Couder, Jun 2, 2020
  68. 11/13 upload-pack: move allow_ref_in_want to upload_pack_dataChristian Couder, Jun 2, 2020
  69. 10/13 upload-pack: move allow_filter to upload_pack_dataChristian Couder, Jun 2, 2020
  70. 09/13 upload-pack: move keepalive to upload_pack_dataChristian Couder, Jun 2, 2020
  71. 12/13 upload-pack: move allow_sideband_all to upload_pack_dataChristian Couder, Jun 2, 2020
  72. 13/13 upload-pack: move pack_objects_hook to upload_pack_dataChristian Couder, Jun 2, 2020
  73. Jeff KingJun 2, 2020
  74. Junio C HamanoJun 2, 2020
  75. fixup! upload-pack: change multi_ack to an enumJonathan Tan, Jun 2, 2020
  76. Christian CouderJun 2, 2020
  77. 00/13 upload-pack: use 'struct upload_pack_data' thoroughly, part 2Christian Couder, Jun 4, 2020
  78. 01/13 upload-pack: actually use some upload_pack_data bitfieldsChristian Couder, Jun 4, 2020
  79. 02/13 upload-pack: annotate upload_pack_data fieldsChristian Couder, Jun 4, 2020
  80. 03/13 upload-pack: move static vars to upload_pack_dataChristian Couder, Jun 4, 2020
  81. 04/13 upload-pack: move use_sideband to upload_pack_dataChristian Couder, Jun 4, 2020
  82. 08/13 upload-pack: pass upload_pack_data to upload_pack_config()Christian Couder, Jun 4, 2020
  83. 07/13 upload-pack: change multi_ack to an enumChristian Couder, Jun 4, 2020
  84. 09/13 upload-pack: move keepalive to upload_pack_dataChristian Couder, Jun 4, 2020
  85. 10/13 upload-pack: move allow_filter to upload_pack_dataChristian Couder, Jun 4, 2020
  86. 11/13 upload-pack: move allow_ref_in_want to upload_pack_dataChristian Couder, Jun 4, 2020
  87. 12/13 upload-pack: move allow_sideband_all to upload_pack_dataChristian Couder, Jun 4, 2020
  88. 13/13 upload-pack: move pack_objects_hook to upload_pack_dataChristian Couder, Jun 4, 2020
  89. 05/13 upload-pack: move filter_capability_requested to upload_pack_dataChristian Couder, Jun 4, 2020
  90. 06/13 upload-pack: move multi_ack to upload_pack_dataChristian Couder, Jun 4, 2020
  91. Junio C HamanoJun 4, 2020
  92. Christian CouderJun 5, 2020
  93. 00/14 upload-pack: use 'struct upload_pack_data' thoroughly, part 3Christian Couder, Jun 11, 2020
  94. 01/14 upload-pack: pass upload_pack_data to send_shallow_list()Christian Couder, Jun 11, 2020
  95. 03/14 upload-pack: pass upload_pack_data to deepen_by_rev_list()Christian Couder, Jun 11, 2020
  96. 04/14 upload-pack: pass upload_pack_data to send_unshallow()Christian Couder, Jun 11, 2020
  97. 02/14 upload-pack: pass upload_pack_data to deepen()Christian Couder, Jun 11, 2020
  98. 05/14 upload-pack: move shallow_nr to upload_pack_dataChristian Couder, Jun 11, 2020
  99. 07/14 upload-pack: move allow_unadvertised_object_request to upload_pack_dataChristian Couder, Jun 11, 2020
  100. 08/14 upload-pack: change allow_unadvertised_object_request to an enumChristian Couder, Jun 11, 2020
  101. 06/14 upload-pack: move extra_edge_obj to upload_pack_dataChristian Couder, Jun 11, 2020
  102. 10/14 upload-pack: pass upload_pack_data to send_acks()Christian Couder, Jun 11, 2020
  103. 11/14 upload-pack: pass upload_pack_data to ok_to_give_up()Christian Couder, Jun 11, 2020
  104. 12/14 upload-pack: pass upload_pack_data to got_oid()Christian Couder, Jun 11, 2020
  105. 09/14 upload-pack: pass upload_pack_data to process_haves()Christian Couder, Jun 11, 2020
  106. 14/14 upload-pack: refactor common code into do_got_oid()Christian Couder, Jun 11, 2020
  107. 13/14 upload-pack: move oldest_have to upload_pack_dataChristian Couder, Jun 11, 2020
  108. Jonathan TanJun 11, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.