git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rev-parse --show-prefix: add in trailing newline
@ 2012-04-09 13:27 Ross Lagerwall
  2012-04-09 19:07 ` Junio C Hamano
  2012-04-10 17:36 ` Jonathan Nieder
  0 siblings, 2 replies; 9+ messages in thread
From: Ross Lagerwall @ 2012-04-09 13:27 UTC (permalink / raw)
  To: git; +Cc: Ross Lagerwall

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>
---
 builtin/rev-parse.c |    2 ++
 t/t1501-worktree.sh |    2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 98d1cbe..733f626 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 e661147..8f36aa9 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 &&
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-04-10 22:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-09 13:27 [PATCH] rev-parse --show-prefix: add in trailing newline Ross Lagerwall
2012-04-09 19:07 ` Junio C Hamano
2012-04-10  5:30   ` Ross Lagerwall
2012-04-10 14:04   ` Jonathan Nieder
2012-04-10 14:41   ` Andreas Schwab
2012-04-10 16:14     ` Junio C Hamano
2012-04-10 17:36 ` Jonathan Nieder
2012-04-10 17:56   ` Junio C Hamano
2012-04-10 22:51   ` Nguyen Thai Ngoc Duy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).