From: Heikki Hokkanen <hoxu@users.sf.net>
To: git@vger.kernel.org
Cc: gitster@pobox.com
Subject: [PATCH] git show-ref: add --remotes option.
Date: Mon, 13 Oct 2008 22:23:47 +0300 [thread overview]
Message-ID: <48F3A043.5070406@users.sf.net> (raw)
This works as --tags and --heads, limiting the outputted ref types.
Any combination of the three can be used.
Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
---
Documentation/git-show-ref.txt | 10 ++++++----
builtin-show-ref.c | 12 +++++++++---
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/Documentation/git-show-ref.txt b/Documentation/git-show-ref.txt
index 2f173ff..5aea2de 100644
--- a/Documentation/git-show-ref.txt
+++ b/Documentation/git-show-ref.txt
@@ -9,7 +9,8 @@ SYNOPSIS
--------
[verse]
'git show-ref' [-q|--quiet] [--verify] [-h|--head] [-d|--dereference]
- [-s|--hash] [--abbrev] [--tags] [--heads] [--] <pattern>...
+ [-s|--hash] [--abbrev] [--tags] [--heads] [--remotes]
+ [--] <pattern>...
'git show-ref' --exclude-existing[=pattern]
DESCRIPTION
@@ -36,10 +37,11 @@ OPTIONS
--tags::
--heads::
+--remotes::
- Limit to only "refs/heads" and "refs/tags", respectively. These
- options are not mutually exclusive; when given both, references stored
- in "refs/heads" and "refs/tags" are displayed.
+ Limit to only "refs/heads", "refs/tags" and "refs/remotes" respectively.
+ These options are not mutually exclusive; when given all, references
+ stored in "refs/heads", "refs/tags" and "refs/remotes" are displayed.
-d::
--dereference::
diff --git a/builtin-show-ref.c b/builtin-show-ref.c
index 572b114..d2362c2 100644
--- a/builtin-show-ref.c
+++ b/builtin-show-ref.c
@@ -5,10 +5,11 @@
#include "tag.h"
#include "string-list.h"
-static const char show_ref_usage[] = "git show-ref [-q|--quiet] [--verify] [-h|--head] [-d|--dereference] [-s|--hash[=<length>]] [--abbrev[=<length>]] [--tags] [--heads] [--] [pattern*] < ref-list";
+static const char show_ref_usage[] = "git show-ref [-q|--quiet] [--verify] [-h|--head] [-d|--dereference] [-s|--hash[=<length>]] [--abbrev[=<length>]] [--tags] [--heads] [--remotes] [--] [pattern*] < ref-list";
static int deref_tags = 0, show_head = 0, tags_only = 0, heads_only = 0,
- found_match = 0, verify = 0, quiet = 0, hash_only = 0, abbrev = 0;
+ remotes_only = 0, found_match = 0, verify = 0, quiet = 0, hash_only = 0,
+ abbrev = 0;
static const char **pattern;
static void show_one(const char *refname, const unsigned char *sha1)
@@ -26,11 +27,12 @@ static int show_ref(const char *refname, const unsigned char *sha1, int flag, vo
const char *hex;
unsigned char peeled[20];
- if (tags_only || heads_only) {
+ if (tags_only || heads_only || remotes_only) {
int match;
match = heads_only && !prefixcmp(refname, "refs/heads/");
match |= tags_only && !prefixcmp(refname, "refs/tags/");
+ match |= remotes_only && !prefixcmp(refname, "refs/remotes/");
if (!match)
return 0;
}
@@ -217,6 +219,10 @@ int cmd_show_ref(int argc, const char **argv, const char *prefix)
heads_only = 1;
continue;
}
+ if (!strcmp(arg, "--remotes")) {
+ remotes_only = 1;
+ continue;
+ }
if (!strcmp(arg, "--exclude-existing"))
return exclude_existing(NULL);
if (!prefixcmp(arg, "--exclude-existing="))
--
1.6.0.2.526.g5c283.dirty
reply other threads:[~2008-10-13 19:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48F3A043.5070406@users.sf.net \
--to=hoxu@users.sf.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).