From: Jonathan Nieder <jrnieder@xxxxxxxxx> This should make the function easier to find, alongside other functions that parse and act on the content of objects. While at it, add a comment describing the function's API. Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx> --- cache.h | 5 ----- object.h | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/cache.h b/cache.h index 15ba480ac3..89422e7976 100644 --- a/cache.h +++ b/cache.h @@ -1351,11 +1351,6 @@ extern int df_name_compare(const char *name1, int len1, int mode1, const char *n extern int name_compare(const char *name1, size_t len1, const char *name2, size_t len2); extern int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2); -extern void *read_object_with_reference(const unsigned char *sha1, - const char *required_type, - unsigned long *size, - unsigned char *sha1_ret); - extern struct object *peel_to_type(const char *name, int namelen, struct object *o, enum object_type); diff --git a/object.h b/object.h index c9ea2285e8..d676404f00 100644 --- a/object.h +++ b/object.h @@ -108,6 +108,22 @@ extern void *create_object(struct repository *r, const unsigned char *sha1, void void *object_as_type(struct object *obj, enum object_type type, int quiet); +/* + * Resolves 'sha1' to an object of the specified type and returns the + * raw content of the resulting object. + * + * For example, with required_type == OBJ_TREE, this can be passed a + * tree, commit, or tag object id to get the raw tree object pointed + * to by the named object. + * + * Returns NULL if 'sha1' can not be peeled to an object of the + * specified type. + */ +extern void *read_object_with_reference(const unsigned char *sha1, + const char *required_type, + unsigned long *size, + unsigned char *sha1_ret); + /* * Returns the object, having parsed it to find out what it is. * -- 2.15.1.433.g936d1b9894.dirty