Skip to content

Commit bfa6871

Browse files
committed
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>
1 parent 68af47e commit bfa6871

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

merge-ort.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,7 +1857,7 @@ static int merge_submodule(struct merge_options *opt,
18571857
BUG("submodule deleted on one side; this should be handled outside of merge_submodule()");
18581858

18591859
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)))) {
18611861
path_msg(opt, CONFLICT_SUBMODULE_NOT_INITIALIZED, 0,
18621862
path, NULL, NULL, NULL,
18631863
_("Failed to merge submodule %s (not checked out)"),
@@ -2240,7 +2240,7 @@ static int handle_content_merge(struct merge_options *opt,
22402240
two_way = ((S_IFMT & o->mode) != (S_IFMT & a->mode));
22412241

22422242
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,
22442244
&a->oid, &b->oid,
22452245
pathnames, extra_marker_size,
22462246
&result_buf);
@@ -2272,7 +2272,7 @@ static int handle_content_merge(struct merge_options *opt,
22722272
} else if (S_ISGITLINK(a->mode)) {
22732273
int two_way = ((S_IFMT & o->mode) != (S_IFMT & a->mode));
22742274
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,
22762276
&a->oid, &b->oid, &result->oid);
22772277
if (clean < 0)
22782278
return -1;
@@ -2786,7 +2786,7 @@ static void apply_directory_rename_modifications(struct merge_options *opt,
27862786
assert(!new_ci->match_mask);
27872787
new_ci->dirmask = 0;
27882788
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));
27902790

27912791
/*
27922792
* 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,
27992799
continue;
28002800
/* zero out any entries related to files */
28012801
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));
28032803
}
28042804

28052805
/* 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,
32143214
if (type_changed) {
32153215
/* rename vs. typechange */
32163216
/* 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),
32183218
sizeof(oldinfo->stages[0].oid));
32193219
oldinfo->stages[0].mode = 0;
32203220
oldinfo->filemask &= 0x06;
@@ -4102,7 +4102,7 @@ static int process_entry(struct merge_options *opt,
41024102
if (ci->filemask & (1 << i))
41034103
continue;
41044104
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));
41064106
}
41074107
} else if (ci->df_conflict && ci->merged.result.mode != 0) {
41084108
/*
@@ -4149,7 +4149,7 @@ static int process_entry(struct merge_options *opt,
41494149
continue;
41504150
/* zero out any entries related to directories */
41514151
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));
41534153
}
41544154

41554155
/*
@@ -4271,23 +4271,23 @@ static int process_entry(struct merge_options *opt,
42714271
new_ci->merged.result.mode = ci->stages[2].mode;
42724272
oidcpy(&new_ci->merged.result.oid, &ci->stages[2].oid);
42734273
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));
42754275
new_ci->filemask = 5;
42764276
if ((S_IFMT & b_mode) != (S_IFMT & o_mode)) {
42774277
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));
42794279
new_ci->filemask = 4;
42804280
}
42814281

42824282
/* Leave only a in ci, fixing stages. */
42834283
ci->merged.result.mode = ci->stages[1].mode;
42844284
oidcpy(&ci->merged.result.oid, &ci->stages[1].oid);
42854285
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));
42874287
ci->filemask = 3;
42884288
if ((S_IFMT & a_mode) != (S_IFMT & o_mode)) {
42894289
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));
42914291
ci->filemask = 2;
42924292
}
42934293

@@ -4415,7 +4415,7 @@ static int process_entry(struct merge_options *opt,
44154415
/* Deleted on both sides */
44164416
ci->merged.is_null = 1;
44174417
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));
44194419
assert(!ci->df_conflict);
44204420
ci->merged.clean = !ci->path_conflict;
44214421
}

0 commit comments

Comments
 (0)