summaryrefslogtreecommitdiff
path: root/builtin/rebase.c
diff options
context:
space:
mode:
authorLibravatar brian m. carlson <sandals@crustytoothpaste.net>2021-04-26 01:02:56 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-04-27 16:31:39 +0900
commit14228447c9ce664a4e9c31ba10344ec5e4ea4ba5 (patch)
tree75e66ea8ad821e4684497a995d9648658c37fcbf /builtin/rebase.c
parenthash: set, copy, and use algo field in struct object_id (diff)
downloadtgif-14228447c9ce664a4e9c31ba10344ec5e4ea4ba5.tar.xz
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 'builtin/rebase.c')
-rw-r--r--builtin/rebase.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 783b526f6e..c9206b40ea 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -485,7 +485,7 @@ static const char * const builtin_rebase_interactive_usage[] = {
int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
{
struct rebase_options opts = REBASE_OPTIONS_INIT;
- struct object_id squash_onto = null_oid;
+ struct object_id squash_onto = *null_oid();
enum action command = ACTION_NONE;
struct option options[] = {
OPT_NEGBIT(0, "ff", &opts.flags, N_("allow fast-forward"),
@@ -1139,7 +1139,7 @@ static int can_fast_forward(struct commit *onto, struct commit *upstream,
merge_bases = get_merge_bases(onto, head);
if (!merge_bases || merge_bases->next) {
- oidcpy(merge_base, &null_oid);
+ oidcpy(merge_base, null_oid());
goto done;
}