提交 658219f1 编写于 作者: R Ross Lagerwall 提交者: Junio C Hamano

rev-parse --show-prefix: add in trailing newline

Print out a trailing newline when --show-prefix is run with cwd
at the top level of the tree which results in an empty prefix.
Behavior is now like --show-cdup.

Fixes an expected failure in t1501.
Signed-off-by: NRoss Lagerwall <rosslagerwall@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 e8dde3e5
......@@ -634,6 +634,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
if (!strcmp(arg, "--show-prefix")) {
if (prefix)
puts(prefix);
else
putchar('\n');
continue;
}
if (!strcmp(arg, "--show-cdup")) {
......
......@@ -68,7 +68,7 @@ test_expect_success 'inside work tree' '
)
'
test_expect_failure 'empty prefix is actually written out' '
test_expect_success 'empty prefix is actually written out' '
echo >expected &&
(
cd work &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册