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

Re: [PATCH v2 02/10] midx-write: pass down repository to static functions

From
karthik nayak <karthik.188@gmail.com>
Date
Nov 21, 2024, 15:06 UTC
Message-ID
<CAOLa=ZQhjPRnfUhsZOir-a=djC523waw8qn3E8rk0ou7pdH8Hw@mail.gmail.com>
In-Reply-To
<Zz472iMq3nZMoRMf@nand.local>
Taylor Blau <me@ttaylorr.com> writes:
Show 19 quoted lines
> On Tue, Nov 19, 2024 at 04:36:41PM +0100, Karthik Nayak wrote:
>> ---
>>  midx-write.c | 57 +++++++++++++++++++++++++++++++--------------------------
>>  1 file changed, 31 insertions(+), 26 deletions(-)
>
> This patch all seems reasonable to me. When reviewing it in this way, it
> is a little unclear to see which functions need just a repository, just
> a hash_algo, or the whole write_midx_context structure.
>
> I think I might have erred on the side of just passing the
> write_midx_context structure throughout the midx-write.c internals. That
> exposes more of the implementation details than is strictly necessary,
> but it does so to the benefit of making the code (and this patch) easier
> to follow.
>
> I don't feel strongly about it, and I trust that you modified the right
> functions to pass the right data. I just wanted to mention it in case
> you hadn't considered an alternative way to structure this patch.
>

I remember doing something like that and it seemed a lot more noisy than the current iteration.

Regarding `write_midx_context`, I wonder if all these functions need to receive it. Passing only what’s necessary might make the functions' requirements clearer, instead of bundling everything into a large struct.

But then again, if you feel otherwise, I'm happy to change it, I don't feel so strongly about it :)

> Thanks,
> Taylor
Previous: Taylor BlauNext: Karthik Nayak
Message 52 of 70 in “Change midx.c and midx-write.c to not use global variables”
  1. 0/8 Change midx.c and midx-write.c to not use global variablesKarthik Nayak, Nov 15, 2024
  2. 1/8 builtin: pass repository to sub commandsKarthik Nayak, Nov 15, 2024
  3. shejialuoNov 16, 2024
  4. Patrick SteinhardtNov 18, 2024
  5. karthik nayakNov 18, 2024
  6. 2/8 midx-write: add repository field to `write_midx_context`Karthik Nayak, Nov 15, 2024
  7. brian m. carlsonNov 15, 2024
  8. karthik nayakNov 18, 2024
  9. Patrick SteinhardtNov 18, 2024
  10. karthik nayakNov 18, 2024
  11. 3/8 midx-write: pass down repository to `write_midx_file[_only]`Karthik Nayak, Nov 15, 2024
  12. Patrick SteinhardtNov 18, 2024
  13. 4/8 midx: cleanup internal usage of `the_repository` and `the_hash_algo`Karthik Nayak, Nov 15, 2024
  14. Patrick SteinhardtNov 18, 2024
  15. karthik nayakNov 18, 2024
  16. 5/8 midx: pass `repository` to `load_multi_pack_index`Karthik Nayak, Nov 15, 2024
  17. 6/8 midx: pass down `hash_algo` to `get_midx_filename[_ext]`Karthik Nayak, Nov 15, 2024
  18. shejialuoNov 16, 2024
  19. karthik nayakNov 18, 2024
  20. shejialuoNov 19, 2024
  21. 7/8 midx: pass down `hash_algo` to `get_split_midx_filename_ext`Karthik Nayak, Nov 15, 2024
  22. shejialuoNov 16, 2024
  23. 8/8 midx: inline the `MIDX_MIN_SIZE` definitionKarthik Nayak, Nov 15, 2024
  24. karthik nayakNov 15, 2024
  25. 00/10 Change midx.c and midx-write.c to not use global variablesKarthik Nayak, Nov 19, 2024
  26. 01/10 builtin: pass repository to sub commandsKarthik Nayak, Nov 19, 2024
  27. 03/10 midx-write: use `revs->repo` inside `read_refs_snapshot`Karthik Nayak, Nov 19, 2024
  28. shejialuoNov 20, 2024
  29. Richard KerryNov 20, 2024
  30. Taylor BlauNov 20, 2024
  31. karthik nayakNov 21, 2024
  32. Taylor BlauNov 20, 2024
  33. 05/10 midx-write: pass down repository to `write_midx_file[_only]`Karthik Nayak, Nov 19, 2024
  34. Taylor BlauNov 20, 2024
  35. 06/10 midx: cleanup internal usage of `the_repository` and `the_hash_algo`Karthik Nayak, Nov 19, 2024
  36. 07/10 midx: pass `repository` to `load_multi_pack_index`Karthik Nayak, Nov 19, 2024
  37. 08/10 midx: pass down `hash_algo` to `get_midx_filename[_ext]`Karthik Nayak, Nov 19, 2024
  38. Christian CouderNov 20, 2024
  39. karthik nayakNov 21, 2024
  40. 10/10 midx: inline the `MIDX_MIN_SIZE` definitionKarthik Nayak, Nov 19, 2024
  41. shejialuoNov 20, 2024
  42. karthik nayakNov 21, 2024
  43. 09/10 midx: pass down `hash_algo` to `get_split_midx_filename_ext`Karthik Nayak, Nov 19, 2024
  44. Christian CouderNov 20, 2024
  45. Taylor BlauNov 20, 2024
  46. karthik nayakNov 21, 2024
  47. 02/10 midx-write: pass down repository to static functionsKarthik Nayak, Nov 19, 2024
  48. Christian CouderNov 20, 2024
  49. Taylor BlauNov 20, 2024
  50. karthik nayakNov 21, 2024
  51. Taylor BlauNov 20, 2024
  52. karthik nayakNov 21, 2024
  53. 04/10 write-midx: add repository field to `write_midx_context`Karthik Nayak, Nov 19, 2024
  54. Christian CouderNov 20, 2024
  55. Taylor BlauNov 20, 2024
  56. Junio C HamanoNov 21, 2024
  57. Junio C HamanoNov 21, 2024
  58. karthik nayakNov 22, 2024
  59. 0/8 Change midx.c and midx-write.c to not use global variablesKarthik Nayak, Nov 27, 2024
  60. 1/8 midx-write: pass down repository to static functionsKarthik Nayak, Nov 27, 2024
  61. 2/8 midx-write: use `revs->repo` inside `read_refs_snapshot`Karthik Nayak, Nov 27, 2024
  62. 3/8 write-midx: add repository field to `write_midx_context`Karthik Nayak, Nov 27, 2024
  63. 4/8 midx-write: pass down repository to `write_midx_file[_only]`Karthik Nayak, Nov 27, 2024
  64. 5/8 midx: cleanup internal usage of `the_repository` and `the_hash_algo`Karthik Nayak, Nov 27, 2024
  65. 6/8 midx: pass `repository` to `load_multi_pack_index`Karthik Nayak, Nov 27, 2024
  66. 7/8 midx: pass down `hash_algo` to functions using global variablesKarthik Nayak, Nov 27, 2024
  67. 8/8 midx: inline the `MIDX_MIN_SIZE` definitionKarthik Nayak, Nov 27, 2024
  68. Junio C HamanoNov 28, 2024
  69. Patrick SteinhardtDec 3, 2024
  70. Junio C HamanoDec 3, 2024

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.