Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 658219f

Browse files
rosslagerwallgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e8dde3e commit 658219f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

builtin/rev-parse.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
634634
if (!strcmp(arg, "--show-prefix")) {
635635
if (prefix)
636636
puts(prefix);
637+
else
638+
putchar('\n');
637639
continue;
638640
}
639641
if (!strcmp(arg, "--show-cdup")) {

t/t1501-worktree.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ test_expect_success 'inside work tree' '
6868
)
6969
'
7070

71-
test_expect_failure 'empty prefix is actually written out' '
71+
test_expect_success 'empty prefix is actually written out' '
7272
echo >expected &&
7373
(
7474
cd work &&

0 commit comments

Comments
 (0)