diff options
author | Patrick Steinhardt <ps@pks.im> | 2022-11-17 08:47:00 +0300 |
---|---|---|
committer | Taylor Blau <me@ttaylorr.com> | 2022-11-18 00:22:52 +0300 |
commit | 5ff36c9b6bff6e0607ad50d212762ea019c85380 (patch) | |
tree | a7956c6fcda31c0d737414de53f8bd1c962c4861 /builtin/rev-parse.c | |
parent | 8c1bc2a71a7680161532e5eabf4dbfbc81dd07be (diff) |
rev-parse: add `--exclude-hidden=` option
Add a new `--exclude-hidden=` option that is similar to the one we just
added to git-rev-list(1). Given a section name `uploadpack` or `receive`
as argument, it causes us to exclude all references that would be hidden
by the respective `$section.hideRefs` configuration.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'builtin/rev-parse.c')
-rw-r--r-- | builtin/rev-parse.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index 7fa5b6991b..b5666a03bd 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -876,10 +876,14 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) continue; } if (opt_with_value(arg, "--branches", &arg)) { + if (ref_excludes.hidden_refs_configured) + return error(_("--exclude-hidden cannot be used together with --branches")); handle_ref_opt(arg, "refs/heads/"); continue; } if (opt_with_value(arg, "--tags", &arg)) { + if (ref_excludes.hidden_refs_configured) + return error(_("--exclude-hidden cannot be used together with --tags")); handle_ref_opt(arg, "refs/tags/"); continue; } @@ -888,6 +892,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) continue; } if (opt_with_value(arg, "--remotes", &arg)) { + if (ref_excludes.hidden_refs_configured) + return error(_("--exclude-hidden cannot be used together with --remotes")); handle_ref_opt(arg, "refs/remotes/"); continue; } @@ -895,6 +901,10 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) add_ref_exclusion(&ref_excludes, arg); continue; } + if (skip_prefix(arg, "--exclude-hidden=", &arg)) { + exclude_hidden_refs(&ref_excludes, arg); + continue; + } if (!strcmp(arg, "--show-toplevel")) { const char *work_tree = get_git_work_tree(); if (work_tree) |