提交 85cf643f 编写于 作者: J Johan Herland 提交者: Shawn O. Pearce

for-each-ref: Fix --format=%(subject) for log message without newlines

'git for-each-ref --format=%(subject)' currently returns an empty string
if the log message does not contain a newline.

This patch teaches 'git for-each-ref' to return the entire log message
(instead of an empty string) if there is no newline in the log message.
Signed-off-by: NJohan Herland <johan@herland.net>
Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
上级 da65e7c1
......@@ -321,8 +321,8 @@ static const char *find_wholine(const char *who, int wholen, const char *buf, un
static const char *copy_line(const char *buf)
{
const char *eol = strchr(buf, '\n');
if (!eol)
return "";
if (!eol) // simulate strchrnul()
eol = buf + strlen(buf);
return xmemdupz(buf, eol - buf);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册