Skip to content

Commit

Permalink
rev-parse --show-prefix: add in trailing newline
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ross Lagerwall authored and Junio C Hamano committed Apr 10, 2012
1 parent e8dde3e commit 658219f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions builtin/rev-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down
2 changes: 1 addition & 1 deletion t/t1501-worktree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit 658219f

Please sign in to comment.