diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2016-04-07 22:03:03 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-10 21:35:29 +0300 |
commit | 8c346fb1d791f388b307d1832aebc577477ed6fe (patch) | |
tree | 985c9cde85d8290ce70bad789f410581129b2e4e /refs | |
parent | 42a38cf788428bf39db1729ee8c79c64252a2849 (diff) |
files-backend: inline resolve_ref_1() into resolve_ref_unsafe()
resolve_ref_unsafe() wasn't doing anything useful anymore.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs')
-rw-r--r-- | refs/files-backend.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c index f75256882c..120b2dddf8 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1539,14 +1539,16 @@ out: } /* This function needs to return a meaningful errno on failure */ -static const char *resolve_ref_1(const char *refname, - int resolve_flags, - unsigned char *sha1, - int *flags, - struct strbuf *sb_refname) +const char *resolve_ref_unsafe(const char *refname, int resolve_flags, + unsigned char *sha1, int *flags) { + static struct strbuf sb_refname = STRBUF_INIT; + int unused_flags; int symref_count; + if (!flags) + flags = &unused_flags; + *flags = 0; if (check_refname_format(refname, REFNAME_ALLOW_ONELEVEL)) { @@ -1570,7 +1572,7 @@ static const char *resolve_ref_1(const char *refname, for (symref_count = 0; symref_count < MAXDEPTH; symref_count++) { int read_flags = 0; - if (read_raw_ref(refname, sha1, sb_refname, &read_flags)) { + if (read_raw_ref(refname, sha1, &sb_refname, &read_flags)) { *flags |= read_flags; if (errno != ENOENT || (resolve_flags & RESOLVE_REF_READING)) return NULL; @@ -1590,7 +1592,7 @@ static const char *resolve_ref_1(const char *refname, return refname; } - refname = sb_refname->buf; + refname = sb_refname.buf; if (resolve_flags & RESOLVE_REF_NO_RECURSE) { hashclr(sha1); return refname; @@ -1610,21 +1612,6 @@ static const char *resolve_ref_1(const char *refname, return NULL; } -const char *resolve_ref_unsafe(const char *refname, int resolve_flags, - unsigned char *sha1, int *flags) -{ - static struct strbuf sb_refname = STRBUF_INIT; - int unused_flags; - const char *ret; - - if (!flags) - flags = &unused_flags; - - ret = resolve_ref_1(refname, resolve_flags, sha1, flags, - &sb_refname); - return ret; -} - /* * Peel the entry (if possible) and return its new peel_status. If * repeel is true, re-peel the entry even if there is an old peeled |