expose a static helper function as got_object_get_path()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
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;