{"thread":{"id":"15882","subject":"[PATCH] git show-ref: add --remotes option.","startedAt":"2008-10-13T19:23:47Z","lastAt":"2008-10-13T19:23:47Z","messageCount":1,"participants":["Heikki Hokkanen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"92959","messageId":"48F3A043.5070406@users.sf.net","threadId":"15882","inReplyTo":null,"subject":"[PATCH] git show-ref: add --remotes option.","fromName":"Heikki Hokkanen","fromEmail":"hoxu@users.sf.net","sentAt":"2008-10-13T19:23:47Z","receivedAt":"2008-10-13T19:23:47Z","isPatch":true,"sender":{"key":"hoxu@users.sf.net","avatar":null},"body":"This works as --tags and --heads, limiting the outputted ref types.\nAny combination of the three can be used.\n\nSigned-off-by: Heikki Hokkanen <hoxu@users.sf.net>\n---\n Documentation/git-show-ref.txt |   10 ++++++----\n builtin-show-ref.c             |   12 +++++++++---\n 2 files changed, 15 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-show-ref.txt b/Documentation/git-show-ref.txt\nindex 2f173ff..5aea2de 100644\n--- a/Documentation/git-show-ref.txt\n+++ b/Documentation/git-show-ref.txt\n@@ -9,7 +9,8 @@ SYNOPSIS\n --------\n [verse]\n 'git show-ref' [-q|--quiet] [--verify] [-h|--head] [-d|--dereference]\n-\t     [-s|--hash] [--abbrev] [--tags] [--heads] [--] <pattern>...\n+\t     [-s|--hash] [--abbrev] [--tags] [--heads] [--remotes]\n+\t     [--] <pattern>...\n 'git show-ref' --exclude-existing[=pattern]\n \n DESCRIPTION\n@@ -36,10 +37,11 @@ OPTIONS\n \n --tags::\n --heads::\n+--remotes::\n \n-\tLimit to only \"refs/heads\" and \"refs/tags\", respectively.  These\n-\toptions are not mutually exclusive; when given both, references stored\n-\tin \"refs/heads\" and \"refs/tags\" are displayed.\n+\tLimit to only \"refs/heads\", \"refs/tags\" and \"refs/remotes\" respectively.\n+\tThese options are not mutually exclusive; when given all, references\n+\tstored in \"refs/heads\", \"refs/tags\" and \"refs/remotes\" are displayed.\n \n -d::\n --dereference::\ndiff --git a/builtin-show-ref.c b/builtin-show-ref.c\nindex 572b114..d2362c2 100644\n--- a/builtin-show-ref.c\n+++ b/builtin-show-ref.c\n@@ -5,10 +5,11 @@\n #include \"tag.h\"\n #include \"string-list.h\"\n \n-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\";\n+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\";\n \n static int deref_tags = 0, show_head = 0, tags_only = 0, heads_only = 0,\n-\tfound_match = 0, verify = 0, quiet = 0, hash_only = 0, abbrev = 0;\n+\tremotes_only = 0, found_match = 0, verify = 0, quiet = 0, hash_only = 0,\n+\tabbrev = 0;\n static const char **pattern;\n \n static void show_one(const char *refname, const unsigned char *sha1)\n@@ -26,11 +27,12 @@ static int show_ref(const char *refname, const unsigned char *sha1, int flag, vo\n \tconst char *hex;\n \tunsigned char peeled[20];\n \n-\tif (tags_only || heads_only) {\n+\tif (tags_only || heads_only || remotes_only) {\n \t\tint match;\n \n \t\tmatch = heads_only && !prefixcmp(refname, \"refs/heads/\");\n \t\tmatch |= tags_only && !prefixcmp(refname, \"refs/tags/\");\n+\t\tmatch |= remotes_only && !prefixcmp(refname, \"refs/remotes/\");\n \t\tif (!match)\n \t\t\treturn 0;\n \t}\n@@ -217,6 +219,10 @@ int cmd_show_ref(int argc, const char **argv, const char *prefix)\n \t\t\theads_only = 1;\n \t\t\tcontinue;\n \t\t}\n+\t\tif (!strcmp(arg, \"--remotes\")) {\n+\t\t\tremotes_only = 1;\n+\t\t\tcontinue;\n+\t\t}\n \t\tif (!strcmp(arg, \"--exclude-existing\"))\n \t\t\treturn exclude_existing(NULL);\n \t\tif (!prefixcmp(arg, \"--exclude-existing=\"))\n-- \n1.6.0.2.526.g5c283.dirty\n"}]}