git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 17:25 UTC

[PATCH V2 3/3] wt-status: use hash_algo from local repository instead of global the_hash_algo

From
Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>
Date
Feb 5, 2026, 10:13 UTC
Message-ID
<20260205101524.125452-4-shreyanshpaliwalcmsmn@gmail.com>
In-Reply-To
<20260205101524.125452-1-shreyanshpaliwalcmsmn@gmail.com>

wt-status.c still uses the global the_hash_algo even though a repository instance is already available via struct wt_status.

Replace uses of the_hash_algo with the hash algorithm stored in the associated repository (s->repo->hash_algo or r->hash_algo).

This removes another dependency on global state and keeps wt-status consistent with local repository usage.

Signed-off-by: Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>
---
 wt-status.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index b008682043..52dfd87919 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1816,10 +1816,10 @@ void wt_status_get_state(struct repository *r,
 	if (!sequencer_get_last_command(r, &action)) {
 		if (action == REPLAY_PICK && !state->cherry_pick_in_progress) {
 			state->cherry_pick_in_progress = 1;
-			oidcpy(&state->cherry_pick_head_oid, null_oid(the_hash_algo));
+			oidcpy(&state->cherry_pick_head_oid, null_oid(r->hash_algo));
 		} else if (action == REPLAY_REVERT && !state->revert_in_progress) {
 			state->revert_in_progress = 1;
-			oidcpy(&state->revert_head_oid, null_oid(the_hash_algo));
+			oidcpy(&state->revert_head_oid, null_oid(r->hash_algo));
 		}
 	}
 	if (get_detached_from)
@@ -2631,7 +2631,7 @@ int has_uncommitted_changes(struct repository *r,
 		 * We have no head (or it's corrupt); use the empty tree,
 		 * which will complain if the index is non-empty.
 		 */
-		struct tree *tree = lookup_tree(r, the_hash_algo->empty_tree);
+		struct tree *tree = lookup_tree(r, r->hash_algo->empty_tree);
 		add_pending_object(&rev_info, &tree->object, "");
 	}
 
-- 
2.52.0
Previous: Shreyansh PaliwalNext: Shreyansh Paliwal
Message 22 of 69 in “wt-status: reduce reliance on global state”
  1. 0/3 wt-status: reduce reliance on global stateShreyansh Paliwal, Jan 31, 2026
  2. 1/3 wt-status: replace uses of the_repository with local repository instancesShreyansh Paliwal, Jan 31, 2026
  3. 2/3 wt-status: pass struct repository and wt_status through function parametersShreyansh Paliwal, Jan 31, 2026
  4. 3/3 wt-status: use hash_algo from local repository instead of global the_hash_algoShreyansh Paliwal, Jan 31, 2026
  5. Karthik NayakFeb 2, 2026
  6. Karthik NayakFeb 2, 2026
  7. Junio C HamanoFeb 2, 2026
  8. Shreyansh PaliwalFeb 2, 2026
  9. Shreyansh PaliwalFeb 2, 2026
  10. Junio C HamanoFeb 2, 2026
  11. Junio C HamanoFeb 2, 2026
  12. Shreyansh PaliwalFeb 3, 2026
  13. Phillip WoodFeb 3, 2026
  14. Phillip WoodFeb 3, 2026
  15. Shreyansh PaliwalFeb 3, 2026
  16. Shreyansh PaliwalFeb 3, 2026
  17. Karthik NayakFeb 4, 2026
  18. Shreyansh PaliwalFeb 4, 2026
  19. 0/3 wt-status: reduce reliance on global stateShreyansh Paliwal, Feb 5, 2026
  20. 1/3 wt-status: replace uses of the_repository with local repository instancesShreyansh Paliwal, Feb 5, 2026
  21. 2/3 wt-status: pass struct repository and wt_status through function parametersShreyansh Paliwal, Feb 5, 2026
  22. 3/3 wt-status: use hash_algo from local repository instead of global the_hash_algoShreyansh Paliwal, Feb 5, 2026
  23. Shreyansh PaliwalFeb 5, 2026
  24. Karthik NayakFeb 5, 2026
  25. Karthik NayakFeb 5, 2026
  26. Karthik NayakFeb 5, 2026
  27. Shreyansh PaliwalFeb 5, 2026
  28. Shreyansh PaliwalFeb 5, 2026
  29. Phillip WoodFeb 5, 2026
  30. Phillip WoodFeb 5, 2026
  31. Phillip WoodFeb 5, 2026
  32. Shreyansh PaliwalFeb 5, 2026
  33. Shreyansh PaliwalFeb 5, 2026
  34. Kristoffer HaugsbakkFeb 5, 2026
  35. Shreyansh PaliwalFeb 5, 2026
  36. Karthik NayakFeb 6, 2026
  37. Shreyansh PaliwalFeb 6, 2026
  38. Shreyansh PaliwalFeb 6, 2026
  39. Phillip WoodFeb 6, 2026
  40. Shreyansh PaliwalFeb 6, 2026
  41. 0/3 wt-status: reduce reliance on global stateShreyansh Paliwal, Feb 7, 2026
  42. 1/3 wt-status: pass struct repository through function parametersShreyansh Paliwal, Feb 7, 2026
  43. 2/3 wt-status: replace uses of the_repository with local repository instancesShreyansh Paliwal, Feb 7, 2026
  44. 3/3 wt-status: use hash_algo from local repository instead of global the_hash_algoShreyansh Paliwal, Feb 7, 2026
  45. Junio C HamanoFeb 8, 2026
  46. Junio C HamanoFeb 8, 2026
  47. Shreyansh PaliwalFeb 8, 2026
  48. Shreyansh PaliwalFeb 8, 2026
  49. Junio C HamanoFeb 8, 2026
  50. Shreyansh PaliwalFeb 8, 2026
  51. Karthik NayakFeb 9, 2026
  52. Karthik NayakFeb 9, 2026
  53. Shreyansh PaliwalFeb 9, 2026
  54. Junio C HamanoFeb 9, 2026
  55. Karthik NayakFeb 10, 2026
  56. 0/3 wt-status: reduce reliance on global stateShreyansh Paliwal, Feb 17, 2026
  57. 1/3 wt-status: pass struct repository through function parametersShreyansh Paliwal, Feb 17, 2026
  58. 2/3 wt-status: replace uses of the_repository with local repository instancesShreyansh Paliwal, Feb 17, 2026
  59. 3/3 wt-status: use hash_algo from local repository instead of global the_hash_algoShreyansh Paliwal, Feb 17, 2026
  60. Phillip WoodFeb 18, 2026
  61. Shreyansh PaliwalFeb 18, 2026
  62. 0/3 wt-status: reduce reliance on global stateShreyansh Paliwal, Feb 18, 2026
  63. 1/3 wt-status: pass struct repository through function parametersShreyansh Paliwal, Feb 18, 2026
  64. 2/3 wt-status: replace uses of the_repository with local repository instancesShreyansh Paliwal, Feb 18, 2026
  65. 3/3 wt-status: use hash_algo from local repository instead of global the_hash_algoShreyansh Paliwal, Feb 18, 2026
  66. Junio C HamanoMar 6, 2026
  67. Karthik NayakMar 9, 2026
  68. Phillip WoodMar 9, 2026
  69. Junio C HamanoMar 9, 2026

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.