From b8dbfd030ccc8e5be6b22bc28a342119504e0c2b Mon Sep 17 00:00:00 2001 From: Phillip Wood Date: Mon, 17 Oct 2022 13:17:40 +0000 Subject: rebase: be stricter when reading state files containing oids The state files for 'onto' and 'orig_head' should contain a full hex oid, change the reading functions from get_oid() to get_oid_hex() to reflect this. They should also name commits and not tags so add and use a function that looks up a commit from an oid like lookup_commit_reference() but without dereferencing tags. Suggested-by: Junio C Hamano Signed-off-by: Phillip Wood Signed-off-by: Junio C Hamano --- commit.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'commit.c') diff --git a/commit.c b/commit.c index 1fb1b2ea90..874b3014b5 100644 --- a/commit.c +++ b/commit.c @@ -59,6 +59,14 @@ struct commit *lookup_commit_or_die(const struct object_id *oid, const char *ref return c; } +struct commit *lookup_commit_object(struct repository *r, + const struct object_id *oid) +{ + struct object *obj = parse_object(r, oid); + return obj ? object_as_type(obj, OBJ_COMMIT, 0) : NULL; + +} + struct commit *lookup_commit(struct repository *r, const struct object_id *oid) { struct object *obj = lookup_object(r, oid); -- cgit v1.2.3