Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
rev-parse --symbolic-full-name: don't print '^' if SHA1 is not a ref
author
Johannes Sixt
<johannes.sixt@telecom.at>
Fri, 23 May 2008 14:13:05 +0000
(16:13 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 23 May 2008 22:52:20 +0000
(15:52 -0700)
The intention of --symbolic-full-name is to not print anything if a
revision is not an exact ref. But this command:
$ git-rev-parse --symbolic-full-name --not master~1
still emitted a sole '^' to stdout (provided that there's no other ref at
master~1). This fixes it.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-rev-parse.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
e77b0b5
)
diff --git
a/builtin-rev-parse.c
b/builtin-rev-parse.c
index 90dbb9d7c1a28fd463ba827cb8da2eab42e489df..1ae086ad1761e08a522138bf843c2ef1bb9c192f 100644
(file)
--- a/
builtin-rev-parse.c
+++ b/
builtin-rev-parse.c
@@
-96,6
+96,14
@@
static void show(const char *arg)
puts(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)
{
/* 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++;
def = NULL;
revs_count++;
- if (type != show_type)
- putchar('^');
if (symbolic && name) {
if (symbolic == SHOW_SYMBOLIC_FULL) {
unsigned char discard[20];
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 */
*/
break;
case 1: /* happy */
- show
(
full);
+ show
_with_type(type,
full);
break;
default: /* ambiguous */
error("refname '%s' is ambiguous", name);
break;
}
} else {
break;
default: /* ambiguous */
error("refname '%s' is ambiguous", name);
break;
}
} else {
- show
(
name);
+ show
_with_type(type,
name);
}
}
else if (abbrev)
}
}
else if (abbrev)
- show
(
find_unique_abbrev(sha1, abbrev));
+ show
_with_type(type,
find_unique_abbrev(sha1, abbrev));
else
else
- show
(
sha1_to_hex(sha1));
+ show
_with_type(type,
sha1_to_hex(sha1));
}
/* Output a flag, only if filter allows it. */
}
/* Output a flag, only if filter allows it. */