summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 305e22c)
raw | patch | inline | side by side (parent: 305e22c)
author | Christian Couder <chriscool@tuxfamily.org> | |
Sun, 17 Sep 2006 04:20:24 +0000 (06:20 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 17 Sep 2006 09:43:02 +0000 (02:43 -0700) |
With this option only the sha1 hash of the ref should
be printed.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
be printed.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-show-ref.c | patch | blob | history |
diff --git a/builtin-show-ref.c b/builtin-show-ref.c
index 161b2367ead7c15876902dc5c297e30b82063fd6..577d9342733b3295fe8588c2ff18380e47375b56 100644 (file)
--- a/builtin-show-ref.c
+++ b/builtin-show-ref.c
#include "object.h"
#include "tag.h"
-static const char show_ref_usage[] = "git show-ref [-q|--quiet] [--verify] [-h|--head] [-d|--deref] [--tags] [--heads] [--] [pattern*]";
+static const char show_ref_usage[] = "git show-ref [-q|--quiet] [--verify] [-h|--head] [-d|--deref] [-s|--hash] [--tags] [--heads] [--] [pattern*]";
-static int deref_tags = 0, show_head = 0, tags_only = 0, heads_only = 0, found_match = 0, verify = 0, quiet = 0;
+static int deref_tags = 0, show_head = 0, tags_only = 0, heads_only = 0,
+ found_match = 0, verify = 0, quiet = 0, hash_only = 0;
static const char **pattern;
static int show_ref(const char *refname, const unsigned char *sha1)
}
if (quiet)
return 0;
- printf("%s %s\n", sha1_to_hex(sha1), refname);
+ if (hash_only)
+ printf("%s\n", sha1_to_hex(sha1));
+ else
+ printf("%s %s\n", sha1_to_hex(sha1), refname);
if (deref_tags && obj->type == OBJ_TAG) {
obj = deref_tag(obj, refname, 0);
printf("%s %s^{}\n", sha1_to_hex(obj->sha1), refname);
deref_tags = 1;
continue;
}
+ if (!strcmp(arg, "-s") || !strcmp(arg, "--hash")) {
+ hash_only = 1;
+ continue;
+ }
if (!strcmp(arg, "--verify")) {
verify = 1;
continue;