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

Commit bca57ee

Browse files
committed
Merge branch 'rl/show-empty-prefix'
"git rev-parse --show-prefix" emitted nothing when run at the top-level of the working tree, while "git rev-parse --show-cdup" gave an empty line. Make them consistent. By Ross Lagerwall * rl/show-empty-prefix: rev-parse --show-prefix: add in trailing newline
2 parents 4c9d7bc + 658219f commit bca57ee

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)