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

Re: [PATCH v2 3/5] pack-write: pass hash_algo to `write_idx_file()`

From
Karthik Nayak <karthik.188@gmail.com>
Date
Jan 19, 2025, 11:10 UTC
Message-ID
<CAOLa=ZR=wftoUmOFa5BG_RxGX9v-85zeCs33cZT9Y+rrxa3sDA@mail.gmail.com>
In-Reply-To
<87wmetieb6.fsf@iotcl.com>
Toon Claes <toon@iotcl.com> writes:
Show 12 quoted lines
> Karthik Nayak <karthik.188@gmail.com> writes:
>
>> The `write_idx_file()` function uses the global `the_hash_algo` variable
>> to access the repository's hash function. To avoid global variable
>> usage, pass the hash function from the layers above.
>>
>> Since `stage_tmp_packfiles()` also resides in 'pack-write.c' and calls
>> `write_idx_file()`, update it to accept `the_hash_algo` as a parameter
>> and pass it through to the callee.
>
> Technically speaking you're updating it to accept a `struct hash_algo`.
>

Yes, but also the callers pass in `the_hash_algo`. But let me amend to make it better.

Show 6 quoted lines
> Besides from this nit, and the other nit I've submitted on the first
> patch, these changes look good to me. I'm doubtful any of the comments
> needs a reroll.
>
> --
> Toon
Thanks for the review! I'll re-roll with the fixes.
Previous: Toon ClaesNext: Karthik Nayak
Message 24 of 36 in “pack-write: cleanup usage of global variables”
  1. 0/5 pack-write: cleanup usage of global variablesKarthik Nayak via B4 Relay, Jan 16, 2025
  2. 1/5 pack-write: pass hash_algo to `fixup_pack_header_footer()`Karthik Nayak via B4 Relay, Jan 16, 2025
  3. Junio C HamanoJan 16, 2025
  4. 2/5 pack-write: pass repository to `index_pack_lockfile()`Karthik Nayak via B4 Relay, Jan 16, 2025
  5. Junio C HamanoJan 16, 2025
  6. Karthik NayakJan 17, 2025
  7. 4/5 pack-write: pass hash_algo to `write_rev_file()`Karthik Nayak via B4 Relay, Jan 16, 2025
  8. Patrick SteinhardtJan 16, 2025
  9. Junio C HamanoJan 16, 2025
  10. 3/5 pack-write: pass hash_algo to `write_idx_file()`Karthik Nayak via B4 Relay, Jan 16, 2025
  11. Patrick SteinhardtJan 16, 2025
  12. Karthik NayakJan 17, 2025
  13. Junio C HamanoJan 16, 2025
  14. Karthik NayakJan 17, 2025
  15. 5/5 pack-write: pass hash_algo to `write_rev_*()`Karthik Nayak via B4 Relay, Jan 16, 2025
  16. 0/5 pack-write: cleanup usage of global variablesKarthik Nayak, Jan 17, 2025
  17. 1/5 pack-write: pass hash_algo to `fixup_pack_header_footer()`Karthik Nayak, Jan 17, 2025
  18. Toon ClaesJan 17, 2025
  19. Junio C HamanoJan 17, 2025
  20. Karthik NayakJan 19, 2025
  21. 2/5 pack-write: pass repository to `index_pack_lockfile()`Karthik Nayak, Jan 17, 2025
  22. 3/5 pack-write: pass hash_algo to `write_idx_file()`Karthik Nayak, Jan 17, 2025
  23. Toon ClaesJan 17, 2025
  24. Karthik NayakJan 19, 2025
  25. 4/5 pack-write: pass hash_algo to `write_rev_file()`Karthik Nayak, Jan 17, 2025
  26. 5/5 pack-write: pass hash_algo to internal functionsKarthik Nayak, Jan 17, 2025
  27. Patrick SteinhardtJan 17, 2025
  28. Karthik NayakJan 17, 2025
  29. 0/5 pack-write: cleanup usage of global variablesKarthik Nayak, Jan 19, 2025
  30. 1/5 pack-write: pass hash_algo to `fixup_pack_header_footer()`Karthik Nayak, Jan 19, 2025
  31. 2/5 pack-write: pass repository to `index_pack_lockfile()`Karthik Nayak, Jan 19, 2025
  32. 3/5 pack-write: pass hash_algo to `write_idx_file()`Karthik Nayak, Jan 19, 2025
  33. 4/5 pack-write: pass hash_algo to `write_rev_file()`Karthik Nayak, Jan 19, 2025
  34. 5/5 pack-write: pass hash_algo to internal functionsKarthik Nayak, Jan 19, 2025
  35. Patrick SteinhardtJan 24, 2025
  36. Junio C HamanoJan 24, 2025

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.