Commit 90bdb554ae5fcbb3f8bfd26f70ed3f540d77c9bd

Stefan Sperling 2019-04-11T14:30:40

expose a static helper function as got_object_get_path()

diff --git a/lib/got_lib_object.h b/lib/got_lib_object.h
index ef0808b..f0d9f81 100644
--- a/lib/got_lib_object.h
+++ b/lib/got_lib_object.h
@@ -92,6 +92,8 @@ struct got_tag_object {
 
 struct got_object_id *got_object_get_id(struct got_object *);
 const struct got_error *got_object_get_id_str(char **, struct got_object *);
+const struct got_error *got_object_get_path(char **, struct got_object_id *,
+    struct got_repository *);
 const struct got_error *got_object_open(struct got_object **,
     struct got_repository *, struct got_object_id *);
 const struct got_error *got_object_open_by_id_str(struct got_object **,
diff --git a/lib/object.c b/lib/object.c
index 0c85256..96343be 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -107,8 +107,9 @@ got_object_get_type(int *type, struct got_repository *repo,
 	return err;
 }
 
-static const struct got_error *
-object_path(char **path, struct got_object_id *id, struct got_repository *repo)
+const struct got_error *
+got_object_get_path(char **path, struct got_object_id *id,
+    struct got_repository *repo)
 {
 	const struct got_error *err = NULL;
 	char *hex = NULL;
@@ -140,7 +141,7 @@ open_loose_object(int *fd, struct got_object_id *id,
 	const struct got_error *err = NULL;
 	char *path;
 
-	err = object_path(&path, id, repo);
+	err = got_object_get_path(&path, id, repo);
 	if (err)
 		return err;
 	*fd = open(path, O_RDONLY | O_NOFOLLOW);
@@ -418,7 +419,7 @@ got_object_open(struct got_object **obj, struct got_repository *repo,
 		return got_repo_cache_object(repo, id, *obj);
 	}
 
-	err = object_path(&path, id, repo);
+	err = got_object_get_path(&path, id, repo);
 	if (err)
 		return err;