]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin-rev-parse.c
rev-parse --branches/--tags/--remotes=pattern
[thirdparty/git.git] / builtin-rev-parse.c
index a635dded65f1d6504bf84c872e0dc4d9efc0126d..d14fe20692aa0903f45da96bf9f31f4564b7816a 100644 (file)
@@ -41,6 +41,7 @@ static int is_rev_argument(const char *arg)
                "--all",
                "--bisect",
                "--dense",
+               "--branches=",
                "--branches",
                "--header",
                "--max-age=",
@@ -51,9 +52,11 @@ static int is_rev_argument(const char *arg)
                "--objects-edge",
                "--parents",
                "--pretty",
+               "--remotes=",
                "--remotes",
                "--glob=",
                "--sparse",
+               "--tags=",
                "--tags",
                "--topo-order",
                "--date-order",
@@ -570,10 +573,20 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                                for_each_ref_in("refs/bisect/good", anti_reference, NULL);
                                continue;
                        }
+                       if (!prefixcmp(arg, "--branches=")) {
+                               for_each_glob_ref_in(show_reference, arg + 11,
+                                       "refs/heads/", NULL);
+                               continue;
+                       }
                        if (!strcmp(arg, "--branches")) {
                                for_each_branch_ref(show_reference, NULL);
                                continue;
                        }
+                       if (!prefixcmp(arg, "--tags=")) {
+                               for_each_glob_ref_in(show_reference, arg + 7,
+                                       "refs/tags/", NULL);
+                               continue;
+                       }
                        if (!strcmp(arg, "--tags")) {
                                for_each_tag_ref(show_reference, NULL);
                                continue;
@@ -582,6 +595,11 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                                for_each_glob_ref(show_reference, arg + 7, NULL);
                                continue;
                        }
+                       if (!prefixcmp(arg, "--remotes=")) {
+                               for_each_glob_ref_in(show_reference, arg + 10,
+                                       "refs/remotes/", NULL);
+                               continue;
+                       }
                        if (!strcmp(arg, "--remotes")) {
                                for_each_remote_ref(show_reference, NULL);
                                continue;