Commit cce2f4851ec199cbdf54fd82f3cc5ab38d5d68f3

Stefan Sperling 2021-08-22T12:56:14

expose got_ref_resolve_symbolic() at the public library API This will be needed by a future 'got send' command.

diff --git a/include/got_reference.h b/include/got_reference.h
index d242c36..57e9e86 100644
--- a/include/got_reference.h
+++ b/include/got_reference.h
@@ -68,7 +68,11 @@ time_t got_ref_get_mtime(struct got_reference *);
  */
 struct got_reference *got_ref_dup(struct got_reference *);
 
-/* Attempt to resolve a reference to an object ID. */
+/* Attempt to resolve a symbolic reference to a non-symbolic one. */
+const struct got_error *got_ref_resolve_symbolic(struct got_reference **,
+    struct got_repository *, struct got_reference *);
+
+/* Attempt to resolve a reference (symbolic or not) to an object ID. */
 const struct got_error *got_ref_resolve(struct got_object_id **,
     struct got_repository *, struct got_reference *);
 
diff --git a/lib/reference.c b/lib/reference.c
index a326d18..951594f 100644
--- a/lib/reference.c
+++ b/lib/reference.c
@@ -592,8 +592,8 @@ got_reflist_entry_dup(struct got_reflist_entry **newp,
 	return NULL;
 }
 
-static const struct got_error *
-resolve_symbolic_ref(struct got_reference **resolved,
+const struct got_error *
+got_ref_resolve_symbolic(struct got_reference **resolved,
     struct got_repository *repo, struct got_reference *ref)
 {
 	struct got_reference *nextref;
@@ -604,7 +604,7 @@ resolve_symbolic_ref(struct got_reference **resolved,
 		return err;
 
 	if (nextref->flags & GOT_REF_IS_SYMBOLIC)
-		err = resolve_symbolic_ref(resolved, repo, nextref);
+		err = got_ref_resolve_symbolic(resolved, repo, nextref);
 	else
 		*resolved = got_ref_dup(nextref);
 
@@ -624,7 +624,7 @@ ref_resolve(struct got_object_id **id, struct got_repository *repo,
 
 	if (ref->flags & GOT_REF_IS_SYMBOLIC) {
 		struct got_reference *resolved = NULL;
-		err = resolve_symbolic_ref(&resolved, repo, ref);
+		err = got_ref_resolve_symbolic(&resolved, repo, ref);
 		if (err == NULL)
 			err = ref_resolve(id, repo, resolved, --recursion);
 		if (resolved)