提交 1f27e7d5 编写于 作者: F Felipe Contreras 提交者: Junio C Hamano

sha1_name: compare variable with constant, not constant with variable

And restructure the if/else to factor out the common "is len positive?"
test into a single conditional.
Signed-off-by: NFelipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 cdfd9483
......@@ -1033,12 +1033,14 @@ int interpret_branch_name(const char *name, struct strbuf *buf)
int len = interpret_nth_prior_checkout(name, buf);
int tmp_len;
if (!len)
if (!len) {
return len; /* syntax Ok, not enough switches */
if (0 < len && len == namelen)
return len; /* consumed all */
else if (0 < len)
return reinterpret(name, namelen, len, buf);
} else if (len > 0) {
if (len == namelen)
return len; /* consumed all */
else
return reinterpret(name, namelen, len, buf);
}
cp = strchr(name, '@');
if (!cp)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册