1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-27 22:46:09 +02:00

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: Ross Lagerwall <rosslagerwall@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ross Lagerwall 2012-04-09 15:27:56 +02:00 committed by Junio C Hamano
parent e8dde3e5f9
commit 658219f1c7
2 changed files with 3 additions and 1 deletions

View File

@ -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")) {

View File

@ -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 &&