read_raw_ref(): take a (struct ref_store *) argument

And make the function work for submodules.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Michael Haggerty
2016-09-04 18:08:20 +02:00
committed by Junio C Hamano
parent b9180c9d5d
commit 34c7ad8ffc
3 changed files with 22 additions and 9 deletions

4
refs.c
View File

@ -1222,6 +1222,7 @@ const char *resolve_ref_unsafe(const char *refname, int resolve_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;
@ -1249,7 +1250,8 @@ const char *resolve_ref_unsafe(const char *refname, int resolve_flags,
for (symref_count = 0; symref_count < SYMREF_MAXDEPTH; symref_count++) {
unsigned int read_flags = 0;
if (read_raw_ref(refname, sha1, &sb_refname, &read_flags)) {
if (read_raw_ref(refs, refname,
sha1, &sb_refname, &read_flags)) {
*flags |= read_flags;
if (errno != ENOENT || (resolve_flags & RESOLVE_REF_READING))
return NULL;