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

[PATCH v3 2/9] tree: update cases to use repo_ tree methods

From
HGHeather Lapointe via GitGitGadget <gitgitgadget@gmail.com>
Date
Oct 17, 2022, 02:23 UTC
Message-ID
<2291e0f9b5c61f9668b206b85368829db9384bb3.1665973401.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1359.v3.git.git.1665973401.gitgitgadget@gmail.com>
From: Heather Lapointe <alpha@alphaservcomputing.solutions>

For cases which had already had a repository instance, update those to use the repo_parse_tree* methods.

Leave the remaining invocations that were already using the_repository alone.

Signed-off-by: Heather Lapointe <alpha@alphaservcomputing.solutions>
---
 merge.c     | 4 ++--
 reset.c     | 2 +-
 revision.c  | 4 ++--
 sequencer.c | 6 +++---
 4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/merge.c b/merge.c
index 2382ff66d35..1efc4440c03 100644
--- a/merge.c
+++ b/merge.c
@@ -63,12 +63,12 @@ int checkout_fast_forward(struct repository *r,
 	memset(&trees, 0, sizeof(trees));
 	memset(&t, 0, sizeof(t));
 
-	trees[nr_trees] = parse_tree_indirect(head);
+	trees[nr_trees] = repo_parse_tree_indirect(r, head);
 	if (!trees[nr_trees++]) {
 		rollback_lock_file(&lock_file);
 		return -1;
 	}
-	trees[nr_trees] = parse_tree_indirect(remote);
+	trees[nr_trees] = repo_parse_tree_indirect(r, remote);
 	if (!trees[nr_trees++]) {
 		rollback_lock_file(&lock_file);
 		return -1;
diff --git a/reset.c b/reset.c
index e3383a93343..a0ac5e8a684 100644
--- a/reset.c
+++ b/reset.c
@@ -153,7 +153,7 @@ int reset_head(struct repository *r, const struct reset_head_opts *opts)
 		goto leave_reset_head;
 	}
 
-	tree = parse_tree_indirect(oid);
+	tree = repo_parse_tree_indirect(r, oid);
 	prime_cache_tree(r, r->index, tree);
 
 	if (write_locked_index(r->index, &lock, COMMIT_LOCK) < 0) {
diff --git a/revision.c b/revision.c
index 36e31942cee..dab5ddaf039 100644
--- a/revision.c
+++ b/revision.c
@@ -74,7 +74,7 @@ static void mark_tree_contents_uninteresting(struct repository *r,
 	struct tree_desc desc;
 	struct name_entry entry;
 
-	if (parse_tree_gently(tree, 1) < 0)
+	if (repo_parse_tree_gently(r, tree, 1) < 0)
 		return;
 
 	init_tree_desc(&desc, tree->buffer, tree->size);
@@ -181,7 +181,7 @@ static void add_children_by_path(struct repository *r,
 	if (!tree)
 		return;
 
-	if (parse_tree_gently(tree, 1) < 0)
+	if (repo_parse_tree_gently(r, tree, 1) < 0)
 		return;
 
 	init_tree_desc(&desc, tree->buffer, tree->size);
diff --git a/sequencer.c b/sequencer.c
index a4d85f1fbdd..a4c09dfa182 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -685,9 +685,9 @@ static int do_recursive_merge(struct repository *r,
 		o.buffer_output = 2;
 	o.show_rename_progress = 1;
 
-	head_tree = parse_tree_indirect(head);
-	next_tree = next ? get_commit_tree(next) : empty_tree(r);
-	base_tree = base ? get_commit_tree(base) : empty_tree(r);
+	head_tree = repo_parse_tree_indirect(r, head);
+	next_tree = next ? repo_get_commit_tree(r, next) : empty_tree(r);
+	base_tree = base ? repo_get_commit_tree(r, base) : empty_tree(r);
 
 	for (i = 0; i < opts->xopts_nr; i++)
 		parse_merge_opt(&o, opts->xopts[i]);
-- 
gitgitgadget
Previous: Junio C HamanoNext: Heather Lapointe via GitGitGadget
Message 16 of 48 in “archive: add --recurse-submodules to git-archive command”
  1. archive: add --recurse-submodules to git-archive commandHeather Lapointe via GitGitGadget, Oct 12, 2022
  2. 0/2 archive: Add --recurse-submodules to git-archive commandHeather Lapointe via GitGitGadget, Oct 13, 2022
  3. 2/2 archive: fix a case of submodule in submodule traversalAlphadelta14 via GitGitGadget, Oct 13, 2022
  4. 1/2 archive: add --recurse-submodules to git-archive commandAlphadelta14 via GitGitGadget, Oct 13, 2022
  5. René ScharfeOct 13, 2022
  6. Heather LapointeOct 13, 2022
  7. René ScharfeOct 13, 2022
  8. Heather LapointeOct 13, 2022
  9. René ScharfeOct 14, 2022
  10. 0/9 archive: Add --recurse-submodules to git-archive commandHeather Lapointe via GitGitGadget, Oct 17, 2022
  11. 1/9 tree: do not use the_repository for tree traversal methods.Alphadelta14 via GitGitGadget, Oct 17, 2022
  12. Junio C HamanoOct 17, 2022
  13. Glen ChooOct 26, 2022
  14. Jonathan TanOct 27, 2022
  15. Junio C HamanoOct 27, 2022
  16. 2/9 tree: update cases to use repo_ tree methodsHeather Lapointe via GitGitGadget, Oct 17, 2022
  17. 3/9 tree: increase test coverage for tree.cHeather Lapointe via GitGitGadget, Oct 17, 2022
  18. Phillip WoodOct 17, 2022
  19. Junio C HamanoOct 17, 2022
  20. Jonathan TanOct 27, 2022
  21. 4/9 tree: handle submodule case for read_tree_at properlyHeather Lapointe via GitGitGadget, Oct 17, 2022
  22. Phillip WoodOct 17, 2022
  23. Junio C HamanoOct 17, 2022
  24. Glen ChooOct 26, 2022
  25. Jonathan TanOct 27, 2022
  26. 5/9 tree: add repository parameter to read_tree_fn_tHeather Lapointe via GitGitGadget, Oct 17, 2022
  27. 6/9 archive: pass repo objects to write_archive handlersHeather Lapointe via GitGitGadget, Oct 17, 2022
  28. Phillip WoodOct 17, 2022
  29. 7/9 archive: remove global repository from archive_argsHeather Lapointe via GitGitGadget, Oct 17, 2022
  30. 9/9 archive: add tests for git archive --recurse-submodulesHeather Lapointe via GitGitGadget, Oct 17, 2022
  31. Jonathan TanOct 27, 2022
  32. Glen ChooOct 27, 2022
  33. Ævar Arnfjörð BjarmasonOct 28, 2022
  34. 8/9 archive: add --recurse-submodules to git-archive commandHeather Lapointe via GitGitGadget, Oct 17, 2022
  35. Glen ChooOct 26, 2022
  36. René ScharfeOct 27, 2022
  37. Glen ChooOct 27, 2022
  38. Glen ChooOct 27, 2022
  39. Glen ChooOct 27, 2022
  40. Phillip WoodOct 17, 2022
  41. Junio C HamanoOct 18, 2022
  42. Heather LapointeOct 18, 2022
  43. Junio C HamanoOct 19, 2022
  44. Junio C HamanoOct 19, 2022
  45. Junio C HamanoOct 20, 2022
  46. Junio C HamanoOct 21, 2022
  47. Glen ChooOct 26, 2022
  48. Heather LapointeOct 28, 2022

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.