summaryrefslogtreecommitdiff
path: root/merge-ort.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2021-04-26 01:02:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-04-27 07:31:39 (GMT)
commit14228447c9ce664a4e9c31ba10344ec5e4ea4ba5 (patch)
tree75e66ea8ad821e4684497a995d9648658c37fcbf /merge-ort.c
parent5a6dce70d7bb12ee2bc7926254c5b6741b91ac5f (diff)
downloadgit-14228447c9ce664a4e9c31ba10344ec5e4ea4ba5.zip
git-14228447c9ce664a4e9c31ba10344ec5e4ea4ba5.tar.gz
git-14228447c9ce664a4e9c31ba10344ec5e4ea4ba5.tar.bz2
hash: provide per-algorithm null OIDs
Up until recently, object IDs did not have an algorithm member, only a hash. Consequently, it was possible to share one null (all-zeros) object ID among all hash algorithms. Now that we're going to be handling objects from multiple hash algorithms, it's important to make sure that all object IDs have a correct algorithm field. Introduce a per-algorithm null OID, and add it to struct hash_algo. Introduce a wrapper function as well, and use it everywhere we used to use the null_oid constant. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-ort.c')
-rw-r--r--merge-ort.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/merge-ort.c b/merge-ort.c
index 5e118a8..3e552cf 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -1291,7 +1291,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 : &o->oid,
+ two_way ? null_oid() : &o->oid,
&a->oid, &b->oid,
pathnames, extra_marker_size,
&result_buf);
@@ -1313,7 +1313,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 : &o->oid,
+ two_way ? null_oid() : &o->oid,
&a->oid, &b->oid, &result->oid);
if (opt->priv->call_depth && two_way && !clean) {
result->mode = o->mode;
@@ -2123,7 +2123,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,
+ memcpy(&oldinfo->stages[0].oid, null_oid(),
sizeof(oldinfo->stages[0].oid));
oldinfo->stages[0].mode = 0;
oldinfo->filemask &= 0x06;
@@ -2762,7 +2762,7 @@ static void process_entry(struct merge_options *opt,
if (ci->filemask & (1 << i))
continue;
ci->stages[i].mode = 0;
- oidcpy(&ci->stages[i].oid, &null_oid);
+ oidcpy(&ci->stages[i].oid, null_oid());
}
} else if (ci->df_conflict && ci->merged.result.mode != 0) {
/*
@@ -2808,7 +2808,7 @@ static void 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);
+ oidcpy(&new_ci->stages[i].oid, null_oid());
}
/*
@@ -2909,11 +2909,11 @@ static void 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);
+ oidcpy(&new_ci->stages[1].oid, null_oid());
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);
+ oidcpy(&new_ci->stages[0].oid, null_oid());
new_ci->filemask = 4;
}
@@ -2921,11 +2921,11 @@ static void 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);
+ oidcpy(&ci->stages[2].oid, null_oid());
ci->filemask = 3;
if ((S_IFMT & a_mode) != (S_IFMT & o_mode)) {
ci->stages[0].mode = 0;
- oidcpy(&ci->stages[0].oid, &null_oid);
+ oidcpy(&ci->stages[0].oid, null_oid());
ci->filemask = 2;
}
@@ -3042,7 +3042,7 @@ static void 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);
+ oidcpy(&ci->merged.result.oid, null_oid());
ci->merged.clean = !ci->path_conflict;
}