提交 10b98fa5 编写于 作者: N Nguyễn Thái Ngọc Duy 提交者: Junio C Hamano

merge: use return value of resolve_ref() to determine if HEAD is invalid

resolve_ref() only updates "head" when it returns non NULL value (it
may update "head" even when returning NULL, but not in all cases).

Because "head" is not initialized before the call, is_null_sha1() is
not enough. Check also resolve_ref() return value.
Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 b4fd9406
......@@ -1030,7 +1030,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
branch = resolve_ref("HEAD", head, 0, &flag);
if (branch && !prefixcmp(branch, "refs/heads/"))
branch += 11;
if (is_null_sha1(head))
if (!branch || is_null_sha1(head))
head_invalid = 1;
git_config(git_merge_config, NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册