X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-rev-parse.c;h=a8c5043dedd785b8fc43c0921edd01e2adac65e1;hb=7aba6185d55e06db3f3ef18daa63baf3821e5030;hp=37d02335212dea9672e2472970f66dc4ac95dfd1;hpb=b30ccd757354ea09b41e4359b0a5ab429d12f02e;p=git.git diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c index 37d023352..a8c5043de 100644 --- a/builtin-rev-parse.c +++ b/builtin-rev-parse.c @@ -41,6 +41,7 @@ static int is_rev_argument(const char *arg) "--all", "--bisect", "--dense", + "--branches=", "--branches", "--header", "--max-age=", @@ -51,8 +52,11 @@ static int is_rev_argument(const char *arg) "--objects-edge", "--parents", "--pretty", + "--remotes=", "--remotes", + "--glob=", "--sparse", + "--tags=", "--tags", "--topo-order", "--date-order", @@ -569,18 +573,43 @@ 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; } + if (!prefixcmp(arg, "--glob=")) { + 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; } + if (!strcmp(arg, "--show-toplevel")) { + const char *work_tree = get_git_work_tree(); + if (work_tree) + puts(work_tree); + continue; + } if (!strcmp(arg, "--show-prefix")) { if (prefix) puts(prefix);