From: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Elijah Newren <newren@gmail.com>, Elijah Newren <newren@gmail.com>
Subject: [PATCH 1/5] merge-ort: pass repository to write_tree()
Date: Wed, 18 Feb 2026 09:15:11 +0000 [thread overview]
Message-ID: <620c4ea38bc539d87a07e4401f98fbf23be0df5c.1771406115.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2048.git.1771406115.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>
In order to get rid of a usage of the_repository, we need to know the
value of opt->repo; pass it along to write_tree(). Once we have the
repository, though, we no longer need to pass
opt->repo->hash_algo->rawsz, we can have write_tree() look up that value
itself.
Signed-off-by: Elijah Newren <newren@gmail.com>
---
merge-ort.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/merge-ort.c b/merge-ort.c
index 0a59d1e596..42499f7b43 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -3822,15 +3822,16 @@ static int tree_entry_order(const void *a_, const void *b_)
b->string, strlen(b->string), bmi->result.mode);
}
-static int write_tree(struct object_id *result_oid,
+static int write_tree(struct repository *repo,
+ struct object_id *result_oid,
struct string_list *versions,
- unsigned int offset,
- size_t hash_size)
+ unsigned int offset)
{
size_t maxlen = 0, extra;
unsigned int nr;
struct strbuf buf = STRBUF_INIT;
int i, ret = 0;
+ size_t hash_size = repo->hash_algo->rawsz;
assert(offset <= versions->nr);
nr = versions->nr - offset;
@@ -3856,7 +3857,7 @@ static int write_tree(struct object_id *result_oid,
}
/* Write this object file out, and record in result_oid */
- if (odb_write_object(the_repository->objects, buf.buf,
+ if (odb_write_object(repo->objects, buf.buf,
buf.len, OBJ_TREE, result_oid))
ret = -1;
strbuf_release(&buf);
@@ -4026,8 +4027,8 @@ static int write_completed_directory(struct merge_options *opt,
dir_info->is_null = 0;
dir_info->result.mode = S_IFDIR;
if (record_tree &&
- write_tree(&dir_info->result.oid, &info->versions, offset,
- opt->repo->hash_algo->rawsz) < 0)
+ write_tree(opt->repo, &dir_info->result.oid, &info->versions,
+ offset) < 0)
ret = -1;
}
@@ -4573,8 +4574,7 @@ static int process_entries(struct merge_options *opt,
BUG("dir_metadata accounting completely off; shouldn't happen");
}
if (record_tree &&
- write_tree(result_oid, &dir_metadata.versions, 0,
- opt->repo->hash_algo->rawsz) < 0)
+ write_tree(opt->repo, result_oid, &dir_metadata.versions, 0) < 0)
ret = -1;
cleanup:
string_list_clear(&plist, 0);
--
gitgitgadget
next prev parent reply other threads:[~2026-02-18 9:15 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-18 9:15 [PATCH 0/5] Avoid the_repository in merge-ort and replay Elijah Newren via GitGitGadget
2026-02-18 9:15 ` Elijah Newren via GitGitGadget [this message]
2026-02-18 9:15 ` [PATCH 2/5] merge-ort: replace the_repository with opt->repo Elijah Newren via GitGitGadget
2026-02-18 9:15 ` [PATCH 3/5] merge-ort: replace the_hash_algo with opt->repo->hash_algo Elijah Newren via GitGitGadget
2026-02-19 15:27 ` Patrick Steinhardt
2026-02-19 17:54 ` Elijah Newren
2026-02-18 9:15 ` [PATCH 4/5] merge-ort: prevent the_repository from coming back Elijah Newren via GitGitGadget
2026-02-19 9:48 ` Kristoffer Haugsbakk
2026-02-19 16:00 ` Elijah Newren
2026-02-19 15:27 ` Patrick Steinhardt
2026-02-19 18:42 ` Elijah Newren
2026-02-19 20:30 ` Junio C Hamano
2026-02-19 20:53 ` Elijah Newren
2026-02-18 9:15 ` [PATCH 5/5] replay: " Elijah Newren via GitGitGadget
2026-02-19 15:27 ` Patrick Steinhardt
2026-02-20 1:59 ` [PATCH v2 0/6] Avoid the_repository in merge-ort and replay Elijah Newren via GitGitGadget
2026-02-20 1:59 ` [PATCH v2 1/6] merge,diff: remove the_repository check before prefetching blobs Elijah Newren via GitGitGadget
2026-02-20 8:19 ` Patrick Steinhardt
2026-02-20 18:51 ` Elijah Newren
2026-02-20 1:59 ` [PATCH v2 2/6] merge-ort: pass repository to write_tree() Elijah Newren via GitGitGadget
2026-02-20 1:59 ` [PATCH v2 3/6] merge-ort: replace the_repository with opt->repo Elijah Newren via GitGitGadget
2026-02-20 1:59 ` [PATCH v2 4/6] merge-ort: replace the_hash_algo with opt->repo->hash_algo Elijah Newren via GitGitGadget
2026-02-20 1:59 ` [PATCH v2 5/6] merge-ort: prevent the_repository from coming back Elijah Newren via GitGitGadget
2026-02-20 1:59 ` [PATCH v2 6/6] replay: " Elijah Newren via GitGitGadget
2026-02-21 23:59 ` [PATCH v3 0/6] Avoid the_repository in merge-ort and replay Elijah Newren via GitGitGadget
2026-02-21 23:59 ` [PATCH v3 1/6] merge,diff: remove the_repository check before prefetching blobs Elijah Newren via GitGitGadget
2026-02-21 23:59 ` [PATCH v3 2/6] merge-ort: pass repository to write_tree() Elijah Newren via GitGitGadget
2026-02-21 23:59 ` [PATCH v3 3/6] merge-ort: replace the_repository with opt->repo Elijah Newren via GitGitGadget
2026-02-21 23:59 ` [PATCH v3 4/6] merge-ort: replace the_hash_algo with opt->repo->hash_algo Elijah Newren via GitGitGadget
2026-02-21 23:59 ` [PATCH v3 5/6] merge-ort: prevent the_repository from coming back Elijah Newren via GitGitGadget
2026-02-22 2:38 ` [PATCH v3 0/6] Avoid the_repository in merge-ort and replay Junio C Hamano
2026-02-22 5:03 ` Elijah Newren
2026-02-23 0:42 ` Derrick Stolee
2026-02-24 10:00 ` Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=620c4ea38bc539d87a07e4401f98fbf23be0df5c.1771406115.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=newren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.