Merge branch 'rs/show-ref-incompatible-options'

Code clean-up for sanity checking of command line options for "git
show-ref".

* rs/show-ref-incompatible-options:
  show-ref: use die_for_incompatible_opt3()
This commit is contained in:
Junio C Hamano
2023-12-27 14:52:25 -08:00
2 changed files with 12 additions and 10 deletions

View File

@ -315,9 +315,9 @@ int cmd_show_ref(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, prefix, show_ref_options,
show_ref_usage, 0);
if ((!!exclude_existing_opts.enabled + !!verify + !!exists) > 1)
die(_("only one of '%s', '%s' or '%s' can be given"),
"--exclude-existing", "--verify", "--exists");
die_for_incompatible_opt3(exclude_existing_opts.enabled, "--exclude-existing",
verify, "--verify",
exists, "--exists");
if (exclude_existing_opts.enabled)
return cmd_show_ref__exclude_existing(&exclude_existing_opts);