summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-07-29 20:50:25 +0700
committerJunio C Hamano <gitster@pobox.com>2014-07-29 13:42:12 -0700
commit4f25b3169d44c9bc72cf173dc207d37649c16277 (patch)
tree69f83d7a84c1695a9ab3a32c400d03632f3cf830
parenta0a26b8439aaf7f533817d7e9cc2a66be5e1e2a7 (diff)
downloadgit-4f25b3169d44c9bc72cf173dc207d37649c16277.tar.gz
checkout: no need to call check_linked_checkouts if head_ref is NULL
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/checkout.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index c83f476a36..6ac89eb365 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1202,7 +1202,8 @@ static int parse_branchname_arg(int argc, const char **argv,
unsigned char sha1[20];
int flag;
char *head_ref = resolve_refdup("HEAD", sha1, 0, &flag);
- if (!(flag & REF_ISSYMREF) || strcmp(head_ref, new->path))
+ if (head_ref &&
+ (!(flag & REF_ISSYMREF) || strcmp(head_ref, new->path)))
check_linked_checkouts(new);
free(head_ref);
}