summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Michael Haggerty <mhagger@alum.mit.edu>2016-04-07 15:03:09 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-04-10 11:35:39 -0700
commit7fd12bfbef015bb63f2376f678d71bca54bbc64d (patch)
treeead30367ecd200ef6dfb832fd29d936d6c472a65
parentcheck_aliased_update(): check that dst_name is non-NULL (diff)
downloadtgif-7fd12bfbef015bb63f2376f678d71bca54bbc64d.tar.xz
show_head_ref(): check the result of resolve_ref_namespace()
Only use the result of resolve_ref_namespace() if it is non-NULL. 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>
-rw-r--r--http-backend.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/http-backend.c b/http-backend.c
index 8870a2681e..214881459d 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -484,9 +484,9 @@ static int show_head_ref(const char *refname, const struct object_id *oid,
const char *target = resolve_ref_unsafe(refname,
RESOLVE_REF_READING,
unused.hash, NULL);
- const char *target_nons = strip_namespace(target);
- strbuf_addf(buf, "ref: %s\n", target_nons);
+ if (target)
+ strbuf_addf(buf, "ref: %s\n", strip_namespace(target));
} else {
strbuf_addf(buf, "%s\n", oid_to_hex(oid));
}