From: Junio C Hamano Date: Fri, 11 May 2012 18:13:26 +0000 (-0700) Subject: Merge branch 'rl/show-empty-prefix' into maint X-Git-Tag: v1.7.10.2~9 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/0582afbcb33a7ca32d09620b8dcaee63c5dd6000?hp=e6a1c43aafa8b221e05e57132549dcb3cd7866cf Merge branch 'rl/show-empty-prefix' into maint Unlike "git rev-parse --show-cdup", "--show-prefix" did not give an empty line when run at the top of the working tree. By Ross Lagerwall * rl/show-empty-prefix: rev-parse --show-prefix: add in trailing newline --- 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 &&