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

[PATCH v4 03/19] convert: add get_stream_filter_ca() variant

From
Matheus Tavares <matheus.bernardino@usp.br>
Date
Nov 4, 2020, 20:33 UTC
Message-ID
<8ce20f1031172bd6821392a562a3ecac65c6bc84.1604521275.git.matheus.bernardino@usp.br>
In-Reply-To
<cover.1604521275.git.matheus.bernardino@usp.br>
From: Jeff Hostetler <jeffhost@microsoft.com>

Like the previous patch, we will also need to call get_stream_filter() with a precomputed `struct conv_attrs`, when we add support for parallel checkout workers. So add the _ca() variant which takes the conversion attributes struct as a parameter.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
[matheus.bernardino: move header comment to ca() variant and reword msg]
Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
---
 convert.c | 28 +++++++++++++++++-----------
 convert.h |  2 ++
 2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/convert.c b/convert.c
index ab3d517233..0a61e4e9bf 100644
--- a/convert.c
+++ b/convert.c
@@ -1939,34 +1939,31 @@ static struct stream_filter *ident_filter(const struct object_id *oid)
 }
 
 /*
- * Return an appropriately constructed filter for the path, or NULL if
+ * Return an appropriately constructed filter for the given ca, or NULL if
  * the contents cannot be filtered without reading the whole thing
  * in-core.
  *
  * Note that you would be crazy to set CRLF, smudge/clean or ident to a
  * large binary blob you would want us not to slurp into the memory!
  */
-struct stream_filter *get_stream_filter(const struct index_state *istate,
-					const char *path,
-					const struct object_id *oid)
+struct stream_filter *get_stream_filter_ca(const struct conv_attrs *ca,
+					   const struct object_id *oid)
 {
-	struct conv_attrs ca;
 	struct stream_filter *filter = NULL;
 
-	convert_attrs(istate, &ca, path);
-	if (ca.drv && (ca.drv->process || ca.drv->smudge || ca.drv->clean))
+	if (ca->drv && (ca->drv->process || ca->drv->smudge || ca->drv->clean))
 		return NULL;
 
-	if (ca.working_tree_encoding)
+	if (ca->working_tree_encoding)
 		return NULL;
 
-	if (ca.crlf_action == CRLF_AUTO || ca.crlf_action == CRLF_AUTO_CRLF)
+	if (ca->crlf_action == CRLF_AUTO || ca->crlf_action == CRLF_AUTO_CRLF)
 		return NULL;
 
-	if (ca.ident)
+	if (ca->ident)
 		filter = ident_filter(oid);
 
-	if (output_eol(ca.crlf_action) == EOL_CRLF)
+	if (output_eol(ca->crlf_action) == EOL_CRLF)
 		filter = cascade_filter(filter, lf_to_crlf_filter());
 	else
 		filter = cascade_filter(filter, &null_filter_singleton);
@@ -1974,6 +1971,15 @@ struct stream_filter *get_stream_filter(const struct index_state *istate,
 	return filter;
 }
 
+struct stream_filter *get_stream_filter(const struct index_state *istate,
+					const char *path,
+					const struct object_id *oid)
+{
+	struct conv_attrs ca;
+	convert_attrs(istate, &ca, path);
+	return get_stream_filter_ca(&ca, oid);
+}
+
 void free_stream_filter(struct stream_filter *filter)
 {
 	filter->vtbl->free(filter);
diff --git a/convert.h b/convert.h
index a4838b5e5c..484b50965d 100644
--- a/convert.h
+++ b/convert.h
@@ -179,6 +179,8 @@ struct stream_filter; /* opaque */
 struct stream_filter *get_stream_filter(const struct index_state *istate,
 					const char *path,
 					const struct object_id *);
+struct stream_filter *get_stream_filter_ca(const struct conv_attrs *ca,
+					   const struct object_id *oid);
 void free_stream_filter(struct stream_filter *);
 int is_null_stream_filter(struct stream_filter *);
 
-- 
2.28.0
Previous: Matheus Tavares BernardinoNext: Christian Couder
Message 41 of 93 in “Parallel Checkout (part I)”
  1. 00/19 Parallel Checkout (part I)Matheus Tavares, Oct 29, 2020
  2. 19/19 ci: run test round with parallel-checkout enabledMatheus Tavares, Oct 29, 2020
  3. 18/19 parallel-checkout: add tests related to .gitattributesMatheus Tavares, Oct 29, 2020
  4. 17/19 parallel-checkout: add tests related to clone collisionsMatheus Tavares, Oct 29, 2020
  5. 16/19 parallel-checkout: add tests for basic operationsMatheus Tavares, Oct 29, 2020
  6. 15/19 checkout-index: add parallel checkout supportMatheus Tavares, Oct 29, 2020
  7. 13/19 make_transient_cache_entry(): optionally alloc from mem_poolMatheus Tavares, Oct 29, 2020
  8. 14/19 builtin/checkout.c: complete parallel checkout supportMatheus Tavares, Oct 29, 2020
  9. 10/19 unpack-trees: add basic support for parallel checkoutMatheus Tavares, Oct 29, 2020
  10. Junio C HamanoNov 2, 2020
  11. Matheus Tavares BernardinoNov 3, 2020
  12. 09/19 entry: add checkout_entry_ca() which takes preloaded conv_attrsMatheus Tavares, Oct 29, 2020
  13. Junio C HamanoOct 30, 2020
  14. 11/19 parallel-checkout: make it truly parallelMatheus Tavares, Oct 29, 2020
  15. 12/19 parallel-checkout: support progress displayingMatheus Tavares, Oct 29, 2020
  16. 08/19 entry: move conv_attrs lookup up to checkout_entry()Matheus Tavares, Oct 29, 2020
  17. Junio C HamanoOct 30, 2020
  18. 05/19 entry: extract a header file for entry.c functionsMatheus Tavares, Oct 29, 2020
  19. Junio C HamanoOct 30, 2020
  20. 07/19 entry: extract cache_entry update from write_entry()Matheus Tavares, Oct 29, 2020
  21. 06/19 entry: make fstat_output() and read_blob_entry() publicMatheus Tavares, Oct 29, 2020
  22. 03/19 convert: add get_stream_filter_ca() variantMatheus Tavares, Oct 29, 2020
  23. Junio C HamanoOct 29, 2020
  24. 04/19 convert: add conv_attrs classificationMatheus Tavares, Oct 29, 2020
  25. Junio C HamanoOct 29, 2020
  26. 02/19 convert: add [async_]convert_to_working_tree_ca() variantsMatheus Tavares, Oct 29, 2020
  27. Junio C HamanoOct 29, 2020
  28. 01/19 convert: make convert_attrs() and convert structs publicMatheus Tavares, Oct 29, 2020
  29. Junio C HamanoOct 29, 2020
  30. Matheus Tavares BernardinoOct 30, 2020
  31. Junio C HamanoOct 30, 2020
  32. Junio C HamanoOct 29, 2020
  33. Jeff HostetlerOct 30, 2020
  34. 00/19 Parallel Checkout (part I)Matheus Tavares, Nov 4, 2020
  35. 01/19 convert: make convert_attrs() and convert structs publicMatheus Tavares, Nov 4, 2020
  36. Christian CouderDec 5, 2020
  37. Matheus Tavares BernardinoDec 5, 2020
  38. 02/19 convert: add [async_]convert_to_working_tree_ca() variantsMatheus Tavares, Nov 4, 2020
  39. Christian CouderDec 5, 2020
  40. Matheus Tavares BernardinoDec 5, 2020
  41. 03/19 convert: add get_stream_filter_ca() variantMatheus Tavares, Nov 4, 2020
  42. Christian CouderDec 5, 2020
  43. 04/19 convert: add conv_attrs classificationMatheus Tavares, Nov 4, 2020
  44. Christian CouderDec 5, 2020
  45. Matheus Tavares BernardinoDec 5, 2020
  46. 05/19 entry: extract a header file for entry.c functionsMatheus Tavares, Nov 4, 2020
  47. Christian CouderDec 6, 2020
  48. 06/19 entry: make fstat_output() and read_blob_entry() publicMatheus Tavares, Nov 4, 2020
  49. 07/19 entry: extract cache_entry update from write_entry()Matheus Tavares, Nov 4, 2020
  50. Christian CouderDec 6, 2020
  51. 08/19 entry: move conv_attrs lookup up to checkout_entry()Matheus Tavares, Nov 4, 2020
  52. Christian CouderDec 6, 2020
  53. Matheus Tavares BernardinoDec 7, 2020
  54. 09/19 entry: add checkout_entry_ca() which takes preloaded conv_attrsMatheus Tavares, Nov 4, 2020
  55. Christian CouderDec 6, 2020
  56. Matheus Tavares BernardinoDec 7, 2020
  57. 10/19 unpack-trees: add basic support for parallel checkoutMatheus Tavares, Nov 4, 2020
  58. Christian CouderDec 6, 2020
  59. Matheus Tavares BernardinoDec 7, 2020
  60. 11/19 parallel-checkout: make it truly parallelMatheus Tavares, Nov 4, 2020
  61. Emily ShafferDec 16, 2020
  62. Matheus Tavares BernardinoDec 17, 2020
  63. 12/19 parallel-checkout: support progress displayingMatheus Tavares, Nov 4, 2020
  64. 13/19 make_transient_cache_entry(): optionally alloc from mem_poolMatheus Tavares, Nov 4, 2020
  65. 15/19 checkout-index: add parallel checkout supportMatheus Tavares, Nov 4, 2020
  66. 17/19 parallel-checkout: add tests related to clone collisionsMatheus Tavares, Nov 4, 2020
  67. 18/19 parallel-checkout: add tests related to .gitattributesMatheus Tavares, Nov 4, 2020
  68. 19/19 ci: run test round with parallel-checkout enabledMatheus Tavares, Nov 4, 2020
  69. 16/19 parallel-checkout: add tests for basic operationsMatheus Tavares, Nov 4, 2020
  70. 14/19 builtin/checkout.c: complete parallel checkout supportMatheus Tavares, Nov 4, 2020
  71. 0/9 Parallel Checkout (part I)Matheus Tavares, Dec 16, 2020
  72. 1/9 convert: make convert_attrs() and convert structs publicMatheus Tavares, Dec 16, 2020
  73. 2/9 convert: add [async_]convert_to_working_tree_ca() variantsMatheus Tavares, Dec 16, 2020
  74. 3/9 convert: add get_stream_filter_ca() variantMatheus Tavares, Dec 16, 2020
  75. 5/9 entry: extract a header file for entry.c functionsMatheus Tavares, Dec 16, 2020
  76. 6/9 entry: make fstat_output() and read_blob_entry() publicMatheus Tavares, Dec 16, 2020
  77. 4/9 convert: add classification for conv_attrs structMatheus Tavares, Dec 16, 2020
  78. 7/9 entry: extract update_ce_after_write() from write_entry()Matheus Tavares, Dec 16, 2020
  79. 9/9 entry: add checkout_entry_ca() taking preloaded conv_attrsMatheus Tavares, Dec 16, 2020
  80. 8/9 entry: move conv_attrs lookup up to checkout_entry()Matheus Tavares, Dec 16, 2020
  81. Christian CouderDec 16, 2020
  82. Junio C HamanoDec 17, 2020
  83. 0/9 Parallel Checkout (part 1)Matheus Tavares, Mar 23, 2021
  84. 1/9 convert: make convert_attrs() and convert structs publicMatheus Tavares, Mar 23, 2021
  85. 2/9 convert: add [async_]convert_to_working_tree_ca() variantsMatheus Tavares, Mar 23, 2021
  86. 4/9 convert: add classification for conv_attrs structMatheus Tavares, Mar 23, 2021
  87. 3/9 convert: add get_stream_filter_ca() variantMatheus Tavares, Mar 23, 2021
  88. 6/9 entry: make fstat_output() and read_blob_entry() publicMatheus Tavares, Mar 23, 2021
  89. 8/9 entry: move conv_attrs lookup up to checkout_entry()Matheus Tavares, Mar 23, 2021
  90. 5/9 entry: extract a header file for entry.c functionsMatheus Tavares, Mar 23, 2021
  91. 9/9 entry: add checkout_entry_ca() taking preloaded conv_attrsMatheus Tavares, Mar 23, 2021
  92. 7/9 entry: extract update_ce_after_write() from write_entry()Matheus Tavares, Mar 23, 2021
  93. Junio C HamanoMar 23, 2021

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.