aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-05-23 15:52:43 -0700
committerJunio C Hamano <gitster@pobox.com>2008-05-23 15:52:43 -0700
commit77599cc0bbd0a08defc3bfa80ca52d931d8dc786 (patch)
tree836bbf7742605d6fdccf849bb93919a1db73475b
parent26b4d0039d84010bbfab2148395cc86f87b91286 (diff)
parente00f3790b88ce61f1bdc863011a122b98b43197e (diff)
downloadgit-77599cc0bbd0a08defc3bfa80ca52d931d8dc786.tar.gz
git-77599cc0bbd0a08defc3bfa80ca52d931d8dc786.tar.xz
Merge branch 'maint-1.5.4' into maintv1.5.5.2
* maint-1.5.4: rev-parse --symbolic-full-name: don't print '^' if SHA1 is not a ref
-rw-r--r--builtin-rev-parse.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
index 0351d5443..00b607824 100644
--- a/builtin-rev-parse.c
+++ b/builtin-rev-parse.c
@@ -96,6 +96,14 @@ static void show(const char *arg)
puts(arg);
}
+/* Like show(), but with a negation prefix according to type */
+static void show_with_type(int type, const char *arg)
+{
+ if (type != show_type)
+ putchar('^');
+ show(arg);
+}
+
/* Output a revision, only if filter allows it */
static void show_rev(int type, const unsigned char *sha1, const char *name)
{
@@ -104,8 +112,6 @@ static void show_rev(int type, const unsigned char *sha1, const char *name)
def = NULL;
revs_count++;
- if (type != show_type)
- putchar('^');
if (symbolic && name) {
if (symbolic == SHOW_SYMBOLIC_FULL) {
unsigned char discard[20];
@@ -122,20 +128,20 @@ static void show_rev(int type, const unsigned char *sha1, const char *name)
*/
break;
case 1: /* happy */
- show(full);
+ show_with_type(type, full);
break;
default: /* ambiguous */
error("refname '%s' is ambiguous", name);
break;
}
} else {
- show(name);
+ show_with_type(type, name);
}
}
else if (abbrev)
- show(find_unique_abbrev(sha1, abbrev));
+ show_with_type(type, find_unique_abbrev(sha1, abbrev));
else
- show(sha1_to_hex(sha1));
+ show_with_type(type, sha1_to_hex(sha1));
}
/* Output a flag, only if filter allows it. */