public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
	Patrick Steinhardt <ps@pks.im>, Elijah Newren <newren@gmail.com>,
	Elijah Newren <newren@gmail.com>,
	Elijah Newren <newren@gmail.com>
Subject: [PATCH v3 4/6] merge-ort: replace the_hash_algo with opt->repo->hash_algo
Date: Sat, 21 Feb 2026 23:59:51 +0000	[thread overview]
Message-ID: <09076d81b671c4c5a7582ff23163c4edba912cb6.1771718393.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2048.v3.git.1771718393.gitgitgadget@gmail.com>

From: Elijah Newren <newren@gmail.com>

We have a perfectly valid repository available and do not need to use
the_hash_algo (a shorthand for the_repository->hash_algo), so use the
known repository instead.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 merge-ort.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/merge-ort.c b/merge-ort.c
index 9b6a4c312e..60b4675f39 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -1857,7 +1857,7 @@ static int merge_submodule(struct merge_options *opt,
 		BUG("submodule deleted on one side; this should be handled outside of merge_submodule()");
 
 	if ((sub_not_initialized = repo_submodule_init(&subrepo,
-		opt->repo, path, null_oid(the_hash_algo)))) {
+		opt->repo, path, null_oid(opt->repo->hash_algo)))) {
 		path_msg(opt, CONFLICT_SUBMODULE_NOT_INITIALIZED, 0,
 			 path, NULL, NULL, NULL,
 			 _("Failed to merge submodule %s (not checked out)"),
@@ -2240,7 +2240,7 @@ static int handle_content_merge(struct merge_options *opt,
 		two_way = ((S_IFMT & o->mode) != (S_IFMT & a->mode));
 
 		merge_status = merge_3way(opt, path,
-					  two_way ? null_oid(the_hash_algo) : &o->oid,
+					  two_way ? null_oid(opt->repo->hash_algo) : &o->oid,
 					  &a->oid, &b->oid,
 					  pathnames, extra_marker_size,
 					  &result_buf);
@@ -2272,7 +2272,7 @@ static int handle_content_merge(struct merge_options *opt,
 	} else if (S_ISGITLINK(a->mode)) {
 		int two_way = ((S_IFMT & o->mode) != (S_IFMT & a->mode));
 		clean = merge_submodule(opt, pathnames[0],
-					two_way ? null_oid(the_hash_algo) : &o->oid,
+					two_way ? null_oid(opt->repo->hash_algo) : &o->oid,
 					&a->oid, &b->oid, &result->oid);
 		if (clean < 0)
 			return -1;
@@ -2786,7 +2786,7 @@ static void apply_directory_rename_modifications(struct merge_options *opt,
 		assert(!new_ci->match_mask);
 		new_ci->dirmask = 0;
 		new_ci->stages[1].mode = 0;
-		oidcpy(&new_ci->stages[1].oid, null_oid(the_hash_algo));
+		oidcpy(&new_ci->stages[1].oid, null_oid(opt->repo->hash_algo));
 
 		/*
 		 * Now that we have the file information in new_ci, make sure
@@ -2799,7 +2799,7 @@ static void apply_directory_rename_modifications(struct merge_options *opt,
 				continue;
 			/* zero out any entries related to files */
 			ci->stages[i].mode = 0;
-			oidcpy(&ci->stages[i].oid, null_oid(the_hash_algo));
+			oidcpy(&ci->stages[i].oid, null_oid(opt->repo->hash_algo));
 		}
 
 		/* Now we want to focus on new_ci, so reassign ci to it. */
@@ -3214,7 +3214,7 @@ static int process_renames(struct merge_options *opt,
 			if (type_changed) {
 				/* rename vs. typechange */
 				/* Mark the original as resolved by removal */
-				memcpy(&oldinfo->stages[0].oid, null_oid(the_hash_algo),
+				memcpy(&oldinfo->stages[0].oid, null_oid(opt->repo->hash_algo),
 				       sizeof(oldinfo->stages[0].oid));
 				oldinfo->stages[0].mode = 0;
 				oldinfo->filemask &= 0x06;
@@ -4102,7 +4102,7 @@ static int process_entry(struct merge_options *opt,
 			if (ci->filemask & (1 << i))
 				continue;
 			ci->stages[i].mode = 0;
-			oidcpy(&ci->stages[i].oid, null_oid(the_hash_algo));
+			oidcpy(&ci->stages[i].oid, null_oid(opt->repo->hash_algo));
 		}
 	} else if (ci->df_conflict && ci->merged.result.mode != 0) {
 		/*
@@ -4149,7 +4149,7 @@ static int process_entry(struct merge_options *opt,
 				continue;
 			/* zero out any entries related to directories */
 			new_ci->stages[i].mode = 0;
-			oidcpy(&new_ci->stages[i].oid, null_oid(the_hash_algo));
+			oidcpy(&new_ci->stages[i].oid, null_oid(opt->repo->hash_algo));
 		}
 
 		/*
@@ -4271,11 +4271,11 @@ static int process_entry(struct merge_options *opt,
 			new_ci->merged.result.mode = ci->stages[2].mode;
 			oidcpy(&new_ci->merged.result.oid, &ci->stages[2].oid);
 			new_ci->stages[1].mode = 0;
-			oidcpy(&new_ci->stages[1].oid, null_oid(the_hash_algo));
+			oidcpy(&new_ci->stages[1].oid, null_oid(opt->repo->hash_algo));
 			new_ci->filemask = 5;
 			if ((S_IFMT & b_mode) != (S_IFMT & o_mode)) {
 				new_ci->stages[0].mode = 0;
-				oidcpy(&new_ci->stages[0].oid, null_oid(the_hash_algo));
+				oidcpy(&new_ci->stages[0].oid, null_oid(opt->repo->hash_algo));
 				new_ci->filemask = 4;
 			}
 
@@ -4283,11 +4283,11 @@ static int process_entry(struct merge_options *opt,
 			ci->merged.result.mode = ci->stages[1].mode;
 			oidcpy(&ci->merged.result.oid, &ci->stages[1].oid);
 			ci->stages[2].mode = 0;
-			oidcpy(&ci->stages[2].oid, null_oid(the_hash_algo));
+			oidcpy(&ci->stages[2].oid, null_oid(opt->repo->hash_algo));
 			ci->filemask = 3;
 			if ((S_IFMT & a_mode) != (S_IFMT & o_mode)) {
 				ci->stages[0].mode = 0;
-				oidcpy(&ci->stages[0].oid, null_oid(the_hash_algo));
+				oidcpy(&ci->stages[0].oid, null_oid(opt->repo->hash_algo));
 				ci->filemask = 2;
 			}
 
@@ -4415,7 +4415,7 @@ static int process_entry(struct merge_options *opt,
 		/* Deleted on both sides */
 		ci->merged.is_null = 1;
 		ci->merged.result.mode = 0;
-		oidcpy(&ci->merged.result.oid, null_oid(the_hash_algo));
+		oidcpy(&ci->merged.result.oid, null_oid(opt->repo->hash_algo));
 		assert(!ci->df_conflict);
 		ci->merged.clean = !ci->path_conflict;
 	}
-- 
gitgitgadget


  parent reply	other threads:[~2026-02-22  0:00 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 ` [PATCH 1/5] merge-ort: pass repository to write_tree() Elijah Newren via GitGitGadget
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     ` Elijah Newren via GitGitGadget [this message]
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=09076d81b671c4c5a7582ff23163c4edba912cb6.1771718393.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=kristofferhaugsbakk@fastmail.com \
    --cc=newren@gmail.com \
    --cc=ps@pks.im \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox