aboutsummaryrefslogtreecommitdiffstats
path: root/object.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-05-23 09:14:08 -0700
committerJunio C Hamano <gitster@pobox.com>2024-05-23 09:14:08 -0700
commite55f364398be3cfae6243ada1a6a8bb66ea7cc46 (patch)
treeb06054ea8aef86c3ea920c5b73b99ccffd26b11d /object.h
parent4365c6fcf96caac73dcc412aa25db34cf8df48d5 (diff)
parent00892786b83936ec53d7d38df9bfc4e180fc2e19 (diff)
downloadgit-e55f364398be3cfae6243ada1a6a8bb66ea7cc46.tar.gz
Merge branch 'ps/refs-without-the-repository-updates' into ps/ref-storage-migration
* ps/refs-without-the-repository-updates: refs/packed: remove references to `the_hash_algo` refs/files: remove references to `the_hash_algo` refs/files: use correct repository refs: remove `dwim_log()` refs: drop `git_default_branch_name()` refs: pass repo when peeling objects refs: move object peeling into "object.c" refs: pass ref store when detecting dangling symrefs refs: convert iteration over replace refs to accept ref store refs: retrieve worktree ref stores via associated repository refs: refactor `resolve_gitlink_ref()` to accept a repository refs: pass repo when retrieving submodule ref store refs: track ref stores via strmap refs: implement releasing ref storages refs: rename `init_db` callback to avoid confusion refs: adjust names for `init` and `init_db` callbacks
Diffstat (limited to 'object.h')
-rw-r--r--object.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/object.h b/object.h
index 9293e703cc..83fcc035e9 100644
--- a/object.h
+++ b/object.h
@@ -256,6 +256,41 @@ struct object *lookup_unknown_object(struct repository *r, const struct object_i
struct object *lookup_object_by_type(struct repository *r, const struct object_id *oid,
enum object_type type);
+enum peel_status {
+ /* object was peeled successfully: */
+ PEEL_PEELED = 0,
+
+ /*
+ * object cannot be peeled because the named object (or an
+ * object referred to by a tag in the peel chain), does not
+ * exist.
+ */
+ PEEL_INVALID = -1,
+
+ /* object cannot be peeled because it is not a tag: */
+ PEEL_NON_TAG = -2,
+
+ /* ref_entry contains no peeled value because it is a symref: */
+ PEEL_IS_SYMREF = -3,
+
+ /*
+ * ref_entry cannot be peeled because it is broken (i.e., the
+ * symbolic reference cannot even be resolved to an object
+ * name):
+ */
+ PEEL_BROKEN = -4
+};
+
+/*
+ * Peel the named object; i.e., if the object is a tag, resolve the
+ * tag recursively until a non-tag is found. If successful, store the
+ * result to oid and return PEEL_PEELED. If the object is not a tag
+ * or is not valid, return PEEL_NON_TAG or PEEL_INVALID, respectively,
+ * and leave oid unchanged.
+ */
+enum peel_status peel_object(struct repository *r,
+ const struct object_id *name, struct object_id *oid);
+
struct object_list *object_list_insert(struct object *item,
struct object_list **list_p);