summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2012-04-23 12:40:08 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-04-23 12:40:08 -0700
commitbca57eeac17204338aa142c16843522308b2d321 (patch)
tree73652cee64e974ec9627ccd9468c1024dbf74893
parentMerge branch 'pw/git-p4' (diff)
parentrev-parse --show-prefix: add in trailing newline (diff)
downloadtgif-bca57eeac17204338aa142c16843522308b2d321.tar.xz
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
-rw-r--r--builtin/rev-parse.c2
-rwxr-xr-xt/t1501-worktree.sh2
2 files changed, 3 insertions, 1 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 98d1cbecca..733f626f6c 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -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")) {
diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh
index e661147c57..8f36aa9fc4 100755
--- a/t/t1501-worktree.sh
+++ b/t/t1501-worktree.sh
@@ -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 &&