summaryrefslogtreecommitdiff
path: root/builtin/rev-parse.c
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2012-04-09 13:27:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-04-10 16:25:35 (GMT)
commit658219f1c75e25adbe530a3b681ba3d2332caca6 (patch)
tree54dd4f9e3f1cc633dceffccd6bcb96e35fe5f09d /builtin/rev-parse.c
parente8dde3e5f9ddb7cf95a6ff3cea6cf07c3a2db80d (diff)
downloadgit-658219f1c75e25adbe530a3b681ba3d2332caca6.zip
git-658219f1c75e25adbe530a3b681ba3d2332caca6.tar.gz
git-658219f1c75e25adbe530a3b681ba3d2332caca6.tar.bz2
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 <rosslagerwall@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/rev-parse.c')
-rw-r--r--builtin/rev-parse.c2
1 files changed, 2 insertions, 0 deletions
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")) {