From: Stefan Beller Date: Fri, 04 Oct 2013 14:20:59 GMT Subject: [PATCH] clone: do not segfault when specifying a nonexistent branch Message-ID: <1380896459-6451-1-git-send-email-stefanbeller@googlemail.com> In-Reply-To: <524EC896.3050703@opensoftware.pl> I think we should emit a warning additionally? Signed-off-by: Stefan Beller --- builtin/clone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/clone.c b/builtin/clone.c index 0aff974..b764ad0 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -688,7 +688,7 @@ static void write_refspec_config(const char* src_ref_prefix, if (option_mirror || !option_bare) { if (option_single_branch && !option_mirror) { - if (option_branch) { + if (option_branch && our_head_points_at) { if (strstr(our_head_points_at->name, "refs/tags/")) strbuf_addf(&value, "+%s:%s", our_head_points_at->name, our_head_points_at->name); -- 1.8.4.1.469.gb38b9db