summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6bff6a6)
raw | patch | inline | side by side (parent: 6bff6a6)
author | Junio C Hamano <junkio@cox.net> | |
Tue, 16 Aug 2005 19:36:46 +0000 (12:36 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 17 Aug 2005 19:11:36 +0000 (12:11 -0700) |
This is most useful with --all, --revs-only, --no-flags and --verify.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
rev-parse.c | patch | blob | history |
diff --git a/rev-parse.c b/rev-parse.c
index 39cf63540e389683e020563f6f3a1f51f44c2f20..f1f5163447e98f1afb65137fd7cc9db7ff793b29 100644 (file)
--- a/rev-parse.c
+++ b/rev-parse.c
static int flags_only = 0;
static int no_flags = 0;
static int output_sq = 0;
+static int symbolic = 0;
#define NORMAL 0
#define REVERSED 1
puts(arg);
}
-static void show_rev(int type, const unsigned char *sha1)
+static void show_rev(int type, const unsigned char *sha1, const char *name)
{
if (no_revs)
return;
output_revs++;
- /* Hexadecimal string plus possibly a carret;
- * this does not have to be quoted even under output_sq.
- */
- printf("%s%s%c", type == show_type ? "" : "^", sha1_to_hex(sha1),
- output_sq ? ' ' : '\n');
+ if (type != show_type)
+ putchar('^');
+ if (symbolic && name)
+ show(name);
+ else
+ show(sha1_to_hex(sha1));
}
static void show_rev_arg(char *rev)
def = NULL;
if (!get_sha1(s, sha1)) {
- show_rev(NORMAL, sha1);
+ show_rev(NORMAL, sha1, s);
return;
}
show_arg(s);
static int show_reference(const char *refname, const unsigned char *sha1)
{
- show_rev(NORMAL, sha1);
+ show_rev(NORMAL, sha1, refname);
return 0;
}
show_type ^= REVERSED;
continue;
}
+ if (!strcmp(arg, "--symbolic")) {
+ symbolic = 1;
+ continue;
+ }
if (!strcmp(arg, "--all")) {
for_each_ref(show_reference);
continue;
if (no_revs)
continue;
def = NULL;
- show_rev(NORMAL, end);
- show_rev(REVERSED, sha1);
+ show_rev(NORMAL, end, n);
+ show_rev(REVERSED, sha1, arg);
continue;
}
}
if (no_revs)
continue;
def = NULL;
- show_rev(NORMAL, sha1);
+ show_rev(NORMAL, sha1, arg);
continue;
}
if (*arg == '^' && !get_sha1(arg+1, sha1)) {
if (no_revs)
continue;
def = NULL;
- show_rev(REVERSED, sha1);
+ show_rev(REVERSED, sha1, arg+1);
continue;
}
show_default();