diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2016-09-04 19:08:21 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-09-10 01:28:13 +0300 |
commit | bd40dcda27cc7d6b8b247caa5b650992c5e397fb (patch) | |
tree | 0cf038403818ca5deab3b7d986613bb7439598f8 | |
parent | 34c7ad8ffc79c64d7f2261e6bcf6efd3adb16e7e (diff) |
resolve_ref_recursively(): new function
Add a new function, resolve_ref_recursively(), which is basically like
the old resolve_ref_unsafe() except that it takes a (ref_store *)
argument and also works for submodules.
Re-implement resolve_ref_unsafe() as a thin wrapper around
resolve_ref_recursively().
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | refs.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -1216,13 +1216,14 @@ int for_each_rawref(each_ref_fn fn, void *cb_data) } /* This function needs to return a meaningful errno on failure */ -const char *resolve_ref_unsafe(const char *refname, int resolve_flags, - unsigned char *sha1, int *flags) +static const char *resolve_ref_recursively(struct ref_store *refs, + const char *refname, + int resolve_flags, + unsigned char *sha1, int *flags) { static struct strbuf sb_refname = STRBUF_INIT; int unused_flags; int symref_count; - struct ref_store *refs = get_ref_store(NULL); if (!flags) flags = &unused_flags; @@ -1291,6 +1292,13 @@ const char *resolve_ref_unsafe(const char *refname, int resolve_flags, return NULL; } +const char *resolve_ref_unsafe(const char *refname, int resolve_flags, + unsigned char *sha1, int *flags) +{ + return resolve_ref_recursively(get_ref_store(NULL), refname, + resolve_flags, sha1, flags); +} + /* A pointer to the ref_store for the main repository: */ static struct ref_store *main_ref_store; |