Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- refs.c | 19 ++++++++++++++++--- refs.h | 5 +++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/refs.c b/refs.c index 9c86c44b8..06890db5d 100644 --- a/refs.c +++ b/refs.c @@ -186,16 +186,29 @@ struct ref_filter { void *cb_data; }; -int read_ref_full(const char *refname, int resolve_flags, unsigned char *sha1, int *flags) +int refs_read_ref_full(struct ref_store *refs, + const char *refname, int resolve_flags, + unsigned char *sha1, int *flags) { - if (resolve_ref_unsafe(refname, resolve_flags, sha1, flags)) + if (refs_resolve_ref_unsafe(refs, refname, resolve_flags, sha1, flags)) return 0; return -1; } +int read_ref_full(const char *refname, int resolve_flags, unsigned char *sha1, int *flags) +{ + return refs_read_ref_full(get_main_ref_store(), refname, + resolve_flags, sha1, flags); +} + +int refs_read_ref(struct ref_store *refs, const char *refname, unsigned char *sha1) +{ + return refs_read_ref_full(refs, refname, RESOLVE_REF_READING, sha1, NULL); +} + int read_ref(const char *refname, unsigned char *sha1) { - return read_ref_full(refname, RESOLVE_REF_READING, sha1, NULL); + return refs_read_ref(get_main_ref_store(), refname, sha1); } int ref_exists(const char *refname) diff --git a/refs.h b/refs.h index bce77891a..229a97f59 100644 --- a/refs.h +++ b/refs.h @@ -568,5 +568,10 @@ int refs_create_symref(struct ref_store *refs, const char *refname, const char *target, const char *logmsg); +int refs_read_ref_full(struct ref_store *refs, + const char *refname, int resolve_flags, + unsigned char *sha1, int *flags); +int refs_read_ref(struct ref_store *refs, + const char *refname, unsigned char *sha1); #endif /* REFS_H */ -- 2.11.0.157.gd943d85