Signed-off-by: Ronnie Sahlberg <sahlberg@xxxxxxxxxx> --- refs-common.c | 15 +++++++++++++++ refs.c | 15 --------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/refs-common.c b/refs-common.c index 3b20db3..aafc4c8 100644 --- a/refs-common.c +++ b/refs-common.c @@ -570,6 +570,21 @@ void warn_dangling_symrefs(FILE *fp, const char *msg_fmt, const struct string_li for_each_rawref(warn_if_dangling_symref, &data); } +int head_ref_namespaced(each_ref_fn fn, void *cb_data) +{ + struct strbuf buf = STRBUF_INIT; + int ret = 0; + unsigned char sha1[20]; + int flag; + + strbuf_addf(&buf, "%sHEAD", get_git_namespace()); + if (!read_ref_full(buf.buf, sha1, RESOLVE_REF_READING, &flag)) + ret = fn(buf.buf, sha1, flag, cb_data); + strbuf_release(&buf); + + return ret; +} + int read_ref_full(const char *refname, unsigned char *sha1, int flags, int *ref_flag) { if (resolve_ref_unsafe(refname, sha1, flags, ref_flag)) diff --git a/refs.c b/refs.c index 9aa88ef..e58a7e1 100644 --- a/refs.c +++ b/refs.c @@ -1635,21 +1635,6 @@ int for_each_replace_ref(each_ref_fn fn, void *cb_data) return do_for_each_ref(&ref_cache, "refs/replace/", fn, 13, 0, cb_data); } -int head_ref_namespaced(each_ref_fn fn, void *cb_data) -{ - struct strbuf buf = STRBUF_INIT; - int ret = 0; - unsigned char sha1[20]; - int flag; - - strbuf_addf(&buf, "%sHEAD", get_git_namespace()); - if (!read_ref_full(buf.buf, sha1, RESOLVE_REF_READING, &flag)) - ret = fn(buf.buf, sha1, flag, cb_data); - strbuf_release(&buf); - - return ret; -} - int for_each_namespaced_ref(each_ref_fn fn, void *cb_data) { struct strbuf buf = STRBUF_INIT; -- 2.0.1.556.g3edca4c -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html