merge-ort: replace the_hash_algo with opt->repo->hash_algo

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Feb 21, 2026 at 23:59 UTC 5eae39beb10efeff23c58c1a9f4665ed4c498065
1 file changed +13 -13
merge-ort.c
+13 -13
@@ -1857,7 +1857,7 @@ static int merge_submodule(struct merge_options *opt,
1857 BUG("submodule deleted on one side; this should be handled outside of merge_submodule()");
1858
1859 if ((sub_not_initialized = repo_submodule_init(&subrepo,
1860 - opt->repo, path, null_oid(the_hash_algo)))) {
1860 + opt->repo, path, null_oid(opt->repo->hash_algo)))) {
1861 path_msg(opt, CONFLICT_SUBMODULE_NOT_INITIALIZED, 0,
1862 path, NULL, NULL, NULL,
1863 _("Failed to merge submodule %s (not checked out)"),
@@ -2240,7 +2240,7 @@ static int handle_content_merge(struct merge_options *opt,
2240 two_way = ((S_IFMT & o->mode) != (S_IFMT & a->mode));
2241
2242 merge_status = merge_3way(opt, path,
2243 - two_way ? null_oid(the_hash_algo) : &o->oid,
2243 + two_way ? null_oid(opt->repo->hash_algo) : &o->oid,
2244 &a->oid, &b->oid,
2245 pathnames, extra_marker_size,
2246 &result_buf);
@@ -2272,7 +2272,7 @@ static int handle_content_merge(struct merge_options *opt,
2272 } else if (S_ISGITLINK(a->mode)) {
2273 int two_way = ((S_IFMT & o->mode) != (S_IFMT & a->mode));
2274 clean = merge_submodule(opt, pathnames[0],
2275 - two_way ? null_oid(the_hash_algo) : &o->oid,
2275 + two_way ? null_oid(opt->repo->hash_algo) : &o->oid,
2276 &a->oid, &b->oid, &result->oid);
2277 if (clean < 0)
2278 return -1;
@@ -2786,7 +2786,7 @@ static void apply_directory_rename_modifications(struct merge_options *opt,
2786 assert(!new_ci->match_mask);
2787 new_ci->dirmask = 0;
2788 new_ci->stages[1].mode = 0;
2789 - oidcpy(&new_ci->stages[1].oid, null_oid(the_hash_algo));
2789 + oidcpy(&new_ci->stages[1].oid, null_oid(opt->repo->hash_algo));
2790
2791 /*
2792 * 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,
2799 continue;
2800 /* zero out any entries related to files */
2801 ci->stages[i].mode = 0;
2802 - oidcpy(&ci->stages[i].oid, null_oid(the_hash_algo));
2802 + oidcpy(&ci->stages[i].oid, null_oid(opt->repo->hash_algo));
2803 }
2804
2805 /* 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,
3214 if (type_changed) {
3215 /* rename vs. typechange */
3216 /* Mark the original as resolved by removal */
3217 - memcpy(&oldinfo->stages[0].oid, null_oid(the_hash_algo),
3217 + memcpy(&oldinfo->stages[0].oid, null_oid(opt->repo->hash_algo),
3218 sizeof(oldinfo->stages[0].oid));
3219 oldinfo->stages[0].mode = 0;
3220 oldinfo->filemask &= 0x06;
@@ -4102,7 +4102,7 @@ static int process_entry(struct merge_options *opt,
4102 if (ci->filemask & (1 << i))
4103 continue;
4104 ci->stages[i].mode = 0;
4105 - oidcpy(&ci->stages[i].oid, null_oid(the_hash_algo));
4105 + oidcpy(&ci->stages[i].oid, null_oid(opt->repo->hash_algo));
4106 }
4107 } else if (ci->df_conflict && ci->merged.result.mode != 0) {
4108 /*
@@ -4149,7 +4149,7 @@ static int process_entry(struct merge_options *opt,
4149 continue;
4150 /* zero out any entries related to directories */
4151 new_ci->stages[i].mode = 0;
4152 - oidcpy(&new_ci->stages[i].oid, null_oid(the_hash_algo));
4152 + oidcpy(&new_ci->stages[i].oid, null_oid(opt->repo->hash_algo));
4153 }
4154
4155 /*
@@ -4271,11 +4271,11 @@ static int process_entry(struct merge_options *opt,
4271 new_ci->merged.result.mode = ci->stages[2].mode;
4272 oidcpy(&new_ci->merged.result.oid, &ci->stages[2].oid);
4273 new_ci->stages[1].mode = 0;
4274 - oidcpy(&new_ci->stages[1].oid, null_oid(the_hash_algo));
4274 + oidcpy(&new_ci->stages[1].oid, null_oid(opt->repo->hash_algo));
4275 new_ci->filemask = 5;
4276 if ((S_IFMT & b_mode) != (S_IFMT & o_mode)) {
4277 new_ci->stages[0].mode = 0;
4278 - oidcpy(&new_ci->stages[0].oid, null_oid(the_hash_algo));
4278 + oidcpy(&new_ci->stages[0].oid, null_oid(opt->repo->hash_algo));
4279 new_ci->filemask = 4;
4280 }
4281
@@ -4283,11 +4283,11 @@ static int process_entry(struct merge_options *opt,
4283 ci->merged.result.mode = ci->stages[1].mode;
4284 oidcpy(&ci->merged.result.oid, &ci->stages[1].oid);
4285 ci->stages[2].mode = 0;
4286 - oidcpy(&ci->stages[2].oid, null_oid(the_hash_algo));
4286 + oidcpy(&ci->stages[2].oid, null_oid(opt->repo->hash_algo));
4287 ci->filemask = 3;
4288 if ((S_IFMT & a_mode) != (S_IFMT & o_mode)) {
4289 ci->stages[0].mode = 0;
4290 - oidcpy(&ci->stages[0].oid, null_oid(the_hash_algo));
4290 + oidcpy(&ci->stages[0].oid, null_oid(opt->repo->hash_algo));
4291 ci->filemask = 2;
4292 }
4293
@@ -4415,7 +4415,7 @@ static int process_entry(struct merge_options *opt,
4415 /* Deleted on both sides */
4416 ci->merged.is_null = 1;
4417 ci->merged.result.mode = 0;
4418 - oidcpy(&ci->merged.result.oid, null_oid(the_hash_algo));
4418 + oidcpy(&ci->merged.result.oid, null_oid(opt->repo->hash_algo));
4419 assert(!ci->df_conflict);
4420 ci->merged.clean = !ci->path_conflict;
4421 }