diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-06-20 15:45:16 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-06-20 15:45:17 -0700 |
| commit | 892fd8b89fc62e2b400d7165700e67343f7a1c92 (patch) | |
| tree | 3bb7bcc15ef51a5833f7afd348a34194b1a1d497 /builtin/show-ref.c | |
| parent | 166cdd8915a957f0fb5a2bbca3075489e8e3a754 (diff) | |
| parent | 607c3d372ef89cf16874c288c60423587286d182 (diff) | |
| download | git-892fd8b89fc62e2b400d7165700e67343f7a1c92.tar.gz | |
Merge branch 'jc/heads-are-branches'
The "--heads" option of "ls-remote" and "show-ref" has been been
deprecated; "--branches" replaces "--heads".
* jc/heads-are-branches:
show-ref: introduce --branches and deprecate --heads
ls-remote: introduce --branches and deprecate --heads
refs: call branches branches
Diffstat (limited to 'builtin/show-ref.c')
| -rw-r--r-- | builtin/show-ref.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/builtin/show-ref.c b/builtin/show-ref.c index 3114bdc391..839a5c29f3 100644 --- a/builtin/show-ref.c +++ b/builtin/show-ref.c @@ -11,8 +11,8 @@ static const char * const show_ref_usage[] = { N_("git show-ref [--head] [-d | --dereference]\n" - " [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n" - " [--heads] [--] [<pattern>...]"), + " [-s | --hash[=<n>]] [--abbrev[=<n>]] [--branches] [--tags]\n" + " [--] [<pattern>...]"), N_("git show-ref --verify [-q | --quiet] [-d | --dereference]\n" " [-s | --hash[=<n>]] [--abbrev[=<n>]]\n" " [--] [<ref>...]"), @@ -189,7 +189,7 @@ static int cmd_show_ref__verify(const struct show_one_options *show_one_opts, struct patterns_options { int show_head; - int heads_only; + int branches_only; int tags_only; }; @@ -208,8 +208,8 @@ static int cmd_show_ref__patterns(const struct patterns_options *opts, if (opts->show_head) refs_head_ref(get_main_ref_store(the_repository), show_ref, &show_ref_data); - if (opts->heads_only || opts->tags_only) { - if (opts->heads_only) + if (opts->branches_only || opts->tags_only) { + if (opts->branches_only) refs_for_each_fullref_in(get_main_ref_store(the_repository), "refs/heads/", NULL, show_ref, &show_ref_data); @@ -293,8 +293,10 @@ int cmd_show_ref(int argc, const char **argv, const char *prefix) struct show_one_options show_one_opts = {0}; int verify = 0, exists = 0; const struct option show_ref_options[] = { - OPT_BOOL(0, "tags", &patterns_opts.tags_only, N_("only show tags (can be combined with heads)")), - OPT_BOOL(0, "heads", &patterns_opts.heads_only, N_("only show heads (can be combined with tags)")), + OPT_BOOL(0, "tags", &patterns_opts.tags_only, N_("only show tags (can be combined with branches)")), + OPT_BOOL(0, "branches", &patterns_opts.branches_only, N_("only show branches (can be combined with tags)")), + OPT_HIDDEN_BOOL(0, "heads", &patterns_opts.branches_only, + N_("deprecated synonym for --branches")), OPT_BOOL(0, "exists", &exists, N_("check for reference existence without resolving")), OPT_BOOL(0, "verify", &verify, N_("stricter reference checking, " "requires exact ref path")), |
