Commit Diff


commit - 532920c816b5460c84db87598d47ee510e5b6072
commit + 0bd18d379f824371c6439f6c6d72b23c4169d99c
blob - 04fbd077b6a362cdf09081d894dd539421e0a5a5
blob + 33e4a1aa330d929e58c6ade1fc66a14ea85c252e
--- include/got_object.h
+++ include/got_object.h
@@ -219,5 +219,14 @@ const struct got_error *got_object_open_as_tag(struct 
 /* Dispose of a tag object. */
 void got_object_tag_close(struct got_tag_object *);
 
+/* Get type of the object a tag points to. */
+int got_object_tag_get_object_type(struct got_tag_object *);
+
+/*
+ * Get ID of the object a tag points to.
+ * This must not be freed by the caller. Use got_object_id_dup() if needed.
+ */
+struct got_object_id *got_object_tag_get_object_id(struct got_tag_object *);
+
 const struct got_error *got_object_commit_add_parent(struct got_commit_object *,
     const char *);
blob - 677800fa5e5df772a4be66f4e6346d7e4f055b29
blob + 3845b3eb503de4c17e6c6393d03d9ed1d8294dcd
--- include/got_reference.h
+++ include/got_reference.h
@@ -36,6 +36,9 @@ const struct got_error * got_ref_open(struct got_refer
 /* Dispose of a reference. */
 void got_ref_close(struct got_reference *);
 
+/* Get the name of the reference. */
+const char *got_ref_get_name(struct got_reference *);
+
 /*
  * Create a duplicate copy of a reference.
  * The caller must dispose of this copy with got_ref_close().
blob - c2649fd6feb206a0911e9dfea70cfb3d988e6f70
blob + 785760891223c8f4348d08e21d81613e174e50e2
--- lib/object.c
+++ lib/object.c
@@ -1322,6 +1322,18 @@ got_object_tag_open(struct got_tag_object **tag,
     struct got_repository *repo, struct got_object *obj)
 {
 	return open_tag(tag, repo, got_object_get_id(obj), 1);
+}
+
+int
+got_object_tag_get_object_type(struct got_tag_object *tag)
+{
+	return tag->obj_type;
+}
+
+struct got_object_id *
+got_object_tag_get_object_id(struct got_tag_object *tag)
+{
+	return &tag->id;
 }
 
 static struct got_tree_entry *
blob - c270896af408842bd1b767615b34e227e164d577
blob + b10ac6f0ab6d2274599af6367b05460f121abe76
--- lib/reference.c
+++ lib/reference.c
@@ -416,3 +416,12 @@ got_ref_to_str(struct got_reference *ref)
 
 	return str;
 }
+
+const char *
+got_ref_get_name(struct got_reference *ref)
+{
+	if (ref->flags & GOT_REF_IS_SYMBOLIC)
+		return ref->ref.symref.name;
+
+	return ref->ref.ref.name;
+}