aboutsummaryrefslogtreecommitdiffstats
path: root/commit.h
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2022-10-17 13:17:40 +0000
committerJunio C Hamano <gitster@pobox.com>2022-10-17 11:53:00 -0700
commitb8dbfd030ccc8e5be6b22bc28a342119504e0c2b (patch)
treea7caa68dcf31b2bdef967c896fdfa10eebdb6334 /commit.h
parent05ec41855da2ba813e6cfb5fb1fb86aea623addc (diff)
downloadgit-b8dbfd030ccc8e5be6b22bc28a342119504e0c2b.tar.gz
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 <gitster@pobox.com> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.h')
-rw-r--r--commit.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/commit.h b/commit.h
index 21e4d25ce7..fa39202fa6 100644
--- a/commit.h
+++ b/commit.h
@@ -64,6 +64,19 @@ enum decoration_type {
void add_name_decoration(enum decoration_type type, const char *name, struct object *obj);
const struct name_decoration *get_name_decoration(const struct object *obj);
+/*
+ * Look up commit named by "oid" respecting replacement objects.
+ * Returns NULL if "oid" is not a commit or does not exist.
+ */
+struct commit *lookup_commit_object(struct repository *r, const struct object_id *oid);
+
+/*
+ * Look up commit named by "oid" without replacement objects or
+ * checking for object existence. Returns the requested commit if it
+ * is found in the object cache, NULL if "oid" is in the object cache
+ * but is not a commit and a newly allocated unparsed commit object if
+ * "oid" is not in the object cache.
+ */
struct commit *lookup_commit(struct repository *r, const struct object_id *oid);
struct commit *lookup_commit_reference(struct repository *r,
const struct object_id *oid);