]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'sb/parseopt-boolean-removal'
authorJunio C Hamano <gitster@pobox.com>
Wed, 4 Sep 2013 19:39:02 +0000 (12:39 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 4 Sep 2013 19:39:03 +0000 (12:39 -0700)
Convert most uses of OPT_BOOLEAN/OPTION_BOOLEAN that can use
OPT_BOOL/OPTION_BOOLEAN which have much saner semantics, and turn
remaining ones into OPT_SET_INT, OPT_COUNTUP, etc. as necessary.

* sb/parseopt-boolean-removal:
  revert: use the OPT_CMDMODE for parsing, reducing code
  checkout-index: fix negations of even numbers of -n
  config parsing options: allow one flag multiple times
  hash-object: replace stdin parsing OPT_BOOLEAN by OPT_COUNTUP
  branch, commit, name-rev: ease up boolean conditions
  checkout: remove superfluous local variable
  log, format-patch: parsing uses OPT__QUIET
  Replace deprecated OPT_BOOLEAN by OPT_BOOL
  Remove deprecated OPTION_BOOLEAN for parsing arguments

42 files changed:
Documentation/git-format-patch.txt
builtin/apply.c
builtin/bisect--helper.c
builtin/blame.c
builtin/branch.c
builtin/check-attr.c
builtin/check-ignore.c
builtin/checkout-index.c
builtin/checkout.c
builtin/clean.c
builtin/clone.c
builtin/commit.c
builtin/config.c
builtin/describe.c
builtin/fast-export.c
builtin/fetch.c
builtin/fsck.c
builtin/gc.c
builtin/grep.c
builtin/hash-object.c
builtin/log.c
builtin/ls-files.c
builtin/ls-tree.c
builtin/merge-base.c
builtin/merge-file.c
builtin/merge.c
builtin/mv.c
builtin/name-rev.c
builtin/notes.c
builtin/push.c
builtin/remote.c
builtin/replace.c
builtin/reset.c
builtin/rev-parse.c
builtin/revert.c
builtin/rm.c
builtin/shortlog.c
builtin/show-branch.c
builtin/show-ref.c
builtin/tag.c
builtin/update-ref.c
parse-options.h

index e394276b1a2e2edfbbf8ab1dea9fcd30ca66e61f..9e0ef0eaf32f8861ba7090ae2feb6188c2c2f0b7 100644 (file)
@@ -242,6 +242,7 @@ configuration options in linkgit:git-notes[1] to use this workflow).
 Note that the leading character does not have to be a dot; for example,
 you can use `--suffix=-patch` to get `0001-description-of-my-change-patch`.
 
+-q::
 --quiet::
        Do not print the names of the generated files to standard output.
 
index 50912c928f79cc0bcb4acf3ae50fd9fdc32193e8..ef32e4f62415956aa8e2366589d4cd6200d3bf37 100644 (file)
@@ -4363,23 +4363,23 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
                { OPTION_CALLBACK, 'p', NULL, NULL, N_("num"),
                        N_("remove <num> leading slashes from traditional diff paths"),
                        0, option_parse_p },
-               OPT_BOOLEAN(0, "no-add", &no_add,
+               OPT_BOOL(0, "no-add", &no_add,
                        N_("ignore additions made by the patch")),
-               OPT_BOOLEAN(0, "stat", &diffstat,
+               OPT_BOOL(0, "stat", &diffstat,
                        N_("instead of applying the patch, output diffstat for the input")),
                OPT_NOOP_NOARG(0, "allow-binary-replacement"),
                OPT_NOOP_NOARG(0, "binary"),
-               OPT_BOOLEAN(0, "numstat", &numstat,
+               OPT_BOOL(0, "numstat", &numstat,
                        N_("show number of added and deleted lines in decimal notation")),
-               OPT_BOOLEAN(0, "summary", &summary,
+               OPT_BOOL(0, "summary", &summary,
                        N_("instead of applying the patch, output a summary for the input")),
-               OPT_BOOLEAN(0, "check", &check,
+               OPT_BOOL(0, "check", &check,
                        N_("instead of applying the patch, see if the patch is applicable")),
-               OPT_BOOLEAN(0, "index", &check_index,
+               OPT_BOOL(0, "index", &check_index,
                        N_("make sure the patch is applicable to the current index")),
-               OPT_BOOLEAN(0, "cached", &cached,
+               OPT_BOOL(0, "cached", &cached,
                        N_("apply a patch without touching the working tree")),
-               OPT_BOOLEAN(0, "apply", &force_apply,
+               OPT_BOOL(0, "apply", &force_apply,
                        N_("also apply the patch (use with --stat/--summary/--check)")),
                OPT_BOOL('3', "3way", &threeway,
                         N_( "attempt three-way merge if a patch does not apply")),
@@ -4399,13 +4399,13 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
                { OPTION_CALLBACK, 0, "ignore-whitespace", NULL, NULL,
                        N_("ignore changes in whitespace when finding context"),
                        PARSE_OPT_NOARG, option_parse_space_change },
-               OPT_BOOLEAN('R', "reverse", &apply_in_reverse,
+               OPT_BOOL('R', "reverse", &apply_in_reverse,
                        N_("apply the patch in reverse")),
-               OPT_BOOLEAN(0, "unidiff-zero", &unidiff_zero,
+               OPT_BOOL(0, "unidiff-zero", &unidiff_zero,
                        N_("don't expect at least one line of context")),
-               OPT_BOOLEAN(0, "reject", &apply_with_reject,
+               OPT_BOOL(0, "reject", &apply_with_reject,
                        N_("leave the rejected hunks in corresponding *.rej files")),
-               OPT_BOOLEAN(0, "allow-overlap", &allow_overlap,
+               OPT_BOOL(0, "allow-overlap", &allow_overlap,
                        N_("allow overlapping hunks")),
                OPT__VERBOSE(&apply_verbosely, N_("be verbose")),
                OPT_BIT(0, "inaccurate-eof", &options,
index e3884e3bb61c7dfb0cd97ddba7bd0558b44c6b8f..3324229025300f7d7de600753c03af3ac22e2152 100644 (file)
@@ -13,10 +13,10 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
        int next_all = 0;
        int no_checkout = 0;
        struct option options[] = {
-               OPT_BOOLEAN(0, "next-all", &next_all,
-                           N_("perform 'git bisect next'")),
-               OPT_BOOLEAN(0, "no-checkout", &no_checkout,
-                           N_("update BISECT_HEAD instead of checking out the current commit")),
+               OPT_BOOL(0, "next-all", &next_all,
+                        N_("perform 'git bisect next'")),
+               OPT_BOOL(0, "no-checkout", &no_checkout,
+                        N_("update BISECT_HEAD instead of checking out the current commit")),
                OPT_END()
        };
 
index 079dcd3407881ce0ea988c3f487faf8ca6d3e5d2..f932112e72f42fcfcb418109ecd7c08c3522d4f5 100644 (file)
@@ -2273,10 +2273,10 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
        static const char *revs_file = NULL;
        static const char *contents_from = NULL;
        static const struct option options[] = {
-               OPT_BOOLEAN(0, "incremental", &incremental, N_("Show blame entries as we find them, incrementally")),
-               OPT_BOOLEAN('b', NULL, &blank_boundary, N_("Show blank SHA-1 for boundary commits (Default: off)")),
-               OPT_BOOLEAN(0, "root", &show_root, N_("Do not treat root commits as boundaries (Default: off)")),
-               OPT_BOOLEAN(0, "show-stats", &show_stats, N_("Show work cost statistics")),
+               OPT_BOOL(0, "incremental", &incremental, N_("Show blame entries as we find them, incrementally")),
+               OPT_BOOL('b', NULL, &blank_boundary, N_("Show blank SHA-1 for boundary commits (Default: off)")),
+               OPT_BOOL(0, "root", &show_root, N_("Do not treat root commits as boundaries (Default: off)")),
+               OPT_BOOL(0, "show-stats", &show_stats, N_("Show work cost statistics")),
                OPT_BIT(0, "score-debug", &output_option, N_("Show output score for blame entries"), OUTPUT_SHOW_SCORE),
                OPT_BIT('f', "show-name", &output_option, N_("Show original filename (Default: auto)"), OUTPUT_SHOW_NAME),
                OPT_BIT('n', "show-number", &output_option, N_("Show original linenumber (Default: off)"), OUTPUT_SHOW_NUMBER),
index 083689063f66a614ad6f8ee4a84c79e214d1b6e0..0903763702a436dc8b3ffc89aa64b2598e257446 100644 (file)
@@ -797,7 +797,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                OPT_SET_INT( 0, "set-upstream",  &track, N_("change upstream info"),
                        BRANCH_TRACK_OVERRIDE),
                OPT_STRING('u', "set-upstream-to", &new_upstream, "upstream", "change the upstream info"),
-               OPT_BOOLEAN(0, "unset-upstream", &unset_upstream, "Unset the upstream info"),
+               OPT_BOOL(0, "unset-upstream", &unset_upstream, "Unset the upstream info"),
                OPT__COLOR(&branch_use_color, N_("use colored output")),
                OPT_SET_INT('r', "remotes",     &kinds, N_("act on remote-tracking branches"),
                        REF_REMOTE_BRANCH),
@@ -822,10 +822,10 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                OPT_BIT('D', NULL, &delete, N_("delete branch (even if not merged)"), 2),
                OPT_BIT('m', "move", &rename, N_("move/rename a branch and its reflog"), 1),
                OPT_BIT('M', NULL, &rename, N_("move/rename a branch, even if target exists"), 2),
-               OPT_BOOLEAN(0, "list", &list, N_("list branch names")),
-               OPT_BOOLEAN('l', "create-reflog", &reflog, N_("create the branch's reflog")),
-               OPT_BOOLEAN(0, "edit-description", &edit_description,
-                           N_("edit the description for the branch")),
+               OPT_BOOL(0, "list", &list, N_("list branch names")),
+               OPT_BOOL('l', "create-reflog", &reflog, N_("create the branch's reflog")),
+               OPT_BOOL(0, "edit-description", &edit_description,
+                        N_("edit the description for the branch")),
                OPT__FORCE(&force_create, N_("force creation (when already exists)")),
                {
                        OPTION_CALLBACK, 0, "no-merged", &merge_filter_ref,
@@ -872,7 +872,8 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
        if (with_commit || merge_filter != NO_FILTER)
                list = 1;
 
-       if (!!delete + !!rename + !!force_create + !!list + !!new_upstream + !!unset_upstream > 1)
+       if (!!delete + !!rename + !!force_create + !!new_upstream +
+           list + unset_upstream > 1)
                usage_with_options(builtin_branch_usage, options);
 
        if (abbrev == -1)
index cd46690ec71531cf5fd475814e3423d3f428025d..e9af7b2bfb932d75cdface880be9814885068a50 100644 (file)
@@ -16,11 +16,11 @@ NULL
 static int nul_term_line;
 
 static const struct option check_attr_options[] = {
-       OPT_BOOLEAN('a', "all", &all_attrs, N_("report all attributes set on file")),
-       OPT_BOOLEAN(0,  "cached", &cached_attrs, N_("use .gitattributes only from the index")),
-       OPT_BOOLEAN(0 , "stdin", &stdin_paths, N_("read file names from stdin")),
-       OPT_BOOLEAN('z', NULL, &nul_term_line,
-                   N_("terminate input and output records by a NUL character")),
+       OPT_BOOL('a', "all", &all_attrs, N_("report all attributes set on file")),
+       OPT_BOOL(0,  "cached", &cached_attrs, N_("use .gitattributes only from the index")),
+       OPT_BOOL(0 , "stdin", &stdin_paths, N_("read file names from stdin")),
+       OPT_BOOL('z', NULL, &nul_term_line,
+                N_("terminate input and output records by a NUL character")),
        OPT_END()
 };
 
index 503a559b18bf03aa7d78c2b408289da6297e0cff..25aa2a5f4c7ff0d0394e4df8e5e761ae916055f6 100644 (file)
@@ -18,12 +18,12 @@ static const struct option check_ignore_options[] = {
        OPT__QUIET(&quiet, N_("suppress progress reporting")),
        OPT__VERBOSE(&verbose, N_("be verbose")),
        OPT_GROUP(""),
-       OPT_BOOLEAN(0, "stdin", &stdin_paths,
-                   N_("read file names from stdin")),
-       OPT_BOOLEAN('z', NULL, &nul_term_line,
-                   N_("terminate input and output records by a NUL character")),
-       OPT_BOOLEAN('n', "non-matching", &show_non_matching,
-                   N_("show non-matching input paths")),
+       OPT_BOOL(0, "stdin", &stdin_paths,
+                N_("read file names from stdin")),
+       OPT_BOOL('z', NULL, &nul_term_line,
+                N_("terminate input and output records by a NUL character")),
+       OPT_BOOL('n', "non-matching", &show_non_matching,
+                N_("show non-matching input paths")),
        OPT_END()
 };
 
index b1feda7d5ef34f45ed2de018a56149212b51ec0a..69e167b16c284534d84019ba0f781fe2c3a889dd 100644 (file)
@@ -183,12 +183,12 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
        int prefix_length;
        int force = 0, quiet = 0, not_new = 0;
        struct option builtin_checkout_index_options[] = {
-               OPT_BOOLEAN('a', "all", &all,
+               OPT_BOOL('a', "all", &all,
                        N_("check out all files in the index")),
                OPT__FORCE(&force, N_("force overwrite of existing files")),
                OPT__QUIET(&quiet,
                        N_("no warning for existing files and files not in index")),
-               OPT_BOOLEAN('n', "no-create", &not_new,
+               OPT_BOOL('n', "no-create", &not_new,
                        N_("don't checkout new files")),
                { OPTION_CALLBACK, 'u', "index", &newfd, NULL,
                        N_("update stat information in the index file"),
@@ -196,9 +196,9 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
                { OPTION_CALLBACK, 'z', NULL, NULL, NULL,
                        N_("paths are separated with NUL character"),
                        PARSE_OPT_NOARG, option_parse_z },
-               OPT_BOOLEAN(0, "stdin", &read_from_stdin,
+               OPT_BOOL(0, "stdin", &read_from_stdin,
                        N_("read list of paths from the standard input")),
-               OPT_BOOLEAN(0, "temp", &to_tempfile,
+               OPT_BOOL(0, "temp", &to_tempfile,
                        N_("write the content to temporary files")),
                OPT_CALLBACK(0, "prefix", NULL, N_("string"),
                        N_("when creating files, prepend <string>"),
index 7025938ae30f2ce3104b27f66bf6e1f294edb810..ed39cecf9a80e4e770684b7c5ceb2d117ffbb281 100644 (file)
@@ -228,8 +228,6 @@ static int checkout_paths(const struct checkout_opts *opts,
        int flag;
        struct commit *head;
        int errs = 0;
-       int stage = opts->writeout_stage;
-       int merge = opts->merge;
        int newfd;
        struct lock_file *lock_file;
 
@@ -327,8 +325,8 @@ static int checkout_paths(const struct checkout_opts *opts,
                                continue;
                        if (opts->force) {
                                warning(_("path '%s' is unmerged"), ce->name);
-                       } else if (stage) {
-                               errs |= check_stage(stage, ce, pos);
+                       } else if (opts->writeout_stage) {
+                               errs |= check_stage(opts->writeout_stage, ce, pos);
                        } else if (opts->merge) {
                                errs |= check_stages((1<<2) | (1<<3), ce, pos);
                        } else {
@@ -352,9 +350,9 @@ static int checkout_paths(const struct checkout_opts *opts,
                                errs |= checkout_entry(ce, &state, NULL);
                                continue;
                        }
-                       if (stage)
-                               errs |= checkout_stage(stage, ce, pos, &state);
-                       else if (merge)
+                       if (opts->writeout_stage)
+                               errs |= checkout_stage(opts->writeout_stage, ce, pos, &state);
+                       else if (opts->merge)
                                errs |= checkout_merged(pos, &state);
                        pos = skip_same_name(ce, pos) - 1;
                }
@@ -1056,8 +1054,8 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
                           N_("create and checkout a new branch")),
                OPT_STRING('B', NULL, &opts.new_branch_force, N_("branch"),
                           N_("create/reset and checkout a branch")),
-               OPT_BOOLEAN('l', NULL, &opts.new_branch_log, N_("create reflog for new branch")),
-               OPT_BOOLEAN(0, "detach", &opts.force_detach, N_("detach the HEAD at named commit")),
+               OPT_BOOL('l', NULL, &opts.new_branch_log, N_("create reflog for new branch")),
+               OPT_BOOL(0, "detach", &opts.force_detach, N_("detach the HEAD at named commit")),
                OPT_SET_INT('t', "track",  &opts.track, N_("set upstream info for new branch"),
                        BRANCH_TRACK_EXPLICIT),
                OPT_STRING(0, "orphan", &opts.new_orphan_branch, N_("new branch"), N_("new unparented branch")),
@@ -1066,16 +1064,15 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
                OPT_SET_INT('3', "theirs", &opts.writeout_stage, N_("checkout their version for unmerged files"),
                            3),
                OPT__FORCE(&opts.force, N_("force checkout (throw away local modifications)")),
-               OPT_BOOLEAN('m', "merge", &opts.merge, N_("perform a 3-way merge with the new branch")),
-               OPT_BOOLEAN(0, "overwrite-ignore", &opts.overwrite_ignore, N_("update ignored files (default)")),
+               OPT_BOOL('m', "merge", &opts.merge, N_("perform a 3-way merge with the new branch")),
+               OPT_BOOL(0, "overwrite-ignore", &opts.overwrite_ignore, N_("update ignored files (default)")),
                OPT_STRING(0, "conflict", &conflict_style, N_("style"),
                           N_("conflict style (merge or diff3)")),
-               OPT_BOOLEAN('p', "patch", &opts.patch_mode, N_("select hunks interactively")),
+               OPT_BOOL('p', "patch", &opts.patch_mode, N_("select hunks interactively")),
                OPT_BOOL(0, "ignore-skip-worktree-bits", &opts.ignore_skipworktree,
                         N_("do not limit pathspecs to sparse entries only")),
-               { OPTION_BOOLEAN, 0, "guess", &dwim_new_local_branch, NULL,
-                 N_("second guess 'git checkout no-such-branch'"),
-                 PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
+               OPT_HIDDEN_BOOL(0, "guess", &dwim_new_local_branch,
+                               N_("second guess 'git checkout no-such-branch'")),
                OPT_END(),
        };
 
index 3c85e152e140741855590f422c599407b6d6ae55..4b6fd42be7aeae55c71c7b79ee45fb73973ec0d5 100644 (file)
@@ -875,12 +875,12 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
                OPT__DRY_RUN(&dry_run, N_("dry run")),
                OPT__FORCE(&force, N_("force")),
                OPT_BOOL('i', "interactive", &interactive, N_("interactive cleaning")),
-               OPT_BOOLEAN('d', NULL, &remove_directories,
+               OPT_BOOL('d', NULL, &remove_directories,
                                N_("remove whole directories")),
                { OPTION_CALLBACK, 'e', "exclude", &exclude_list, N_("pattern"),
                  N_("add <pattern> to ignore rules"), PARSE_OPT_NONEG, exclude_cb },
-               OPT_BOOLEAN('x', NULL, &ignored, N_("remove ignored files, too")),
-               OPT_BOOLEAN('X', NULL, &ignored_only,
+               OPT_BOOL('x', NULL, &ignored, N_("remove ignored files, too")),
+               OPT_BOOL('X', NULL, &ignored_only,
                                N_("remove only ignored files")),
                OPT_END()
        };
index 430307b298b4f9ea03ff4caea283b133fde0077e..ca3eb68d72b0ab9ee683eff3206d28012f27c4fc 100644 (file)
@@ -62,23 +62,22 @@ static struct option builtin_clone_options[] = {
        OPT__VERBOSITY(&option_verbosity),
        OPT_BOOL(0, "progress", &option_progress,
                 N_("force progress reporting")),
-       OPT_BOOLEAN('n', "no-checkout", &option_no_checkout,
-                   N_("don't create a checkout")),
-       OPT_BOOLEAN(0, "bare", &option_bare, N_("create a bare repository")),
-       { OPTION_BOOLEAN, 0, "naked", &option_bare, NULL,
-               N_("create a bare repository"),
-               PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
-       OPT_BOOLEAN(0, "mirror", &option_mirror,
-                   N_("create a mirror repository (implies bare)")),
+       OPT_BOOL('n', "no-checkout", &option_no_checkout,
+                N_("don't create a checkout")),
+       OPT_BOOL(0, "bare", &option_bare, N_("create a bare repository")),
+       OPT_HIDDEN_BOOL(0, "naked", &option_bare,
+                       N_("create a bare repository")),
+       OPT_BOOL(0, "mirror", &option_mirror,
+                N_("create a mirror repository (implies bare)")),
        OPT_BOOL('l', "local", &option_local,
                N_("to clone from a local repository")),
-       OPT_BOOLEAN(0, "no-hardlinks", &option_no_hardlinks,
+       OPT_BOOL(0, "no-hardlinks", &option_no_hardlinks,
                    N_("don't use local hardlinks, always copy")),
-       OPT_BOOLEAN('s', "shared", &option_shared,
+       OPT_BOOL('s', "shared", &option_shared,
                    N_("setup as shared repository")),
-       OPT_BOOLEAN(0, "recursive", &option_recursive,
+       OPT_BOOL(0, "recursive", &option_recursive,
                    N_("initialize submodules in the clone")),
-       OPT_BOOLEAN(0, "recurse-submodules", &option_recursive,
+       OPT_BOOL(0, "recurse-submodules", &option_recursive,
                    N_("initialize submodules in the clone")),
        OPT_STRING(0, "template", &option_template, N_("template-directory"),
                   N_("directory from which templates will be used")),
index 10acc53f8012f53b6a15a3d006b622bda3409b17..60812b5b4b0a7215c1d5c441799b9d0857c51dce 100644 (file)
@@ -1091,7 +1091,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
        if (patch_interactive)
                interactive = 1;
 
-       if (!!also + !!only + !!all + !!interactive > 1)
+       if (also + only + all + interactive > 1)
                die(_("Only one of --include/--only/--all/--interactive/--patch can be used."));
        if (argc == 0 && (also || (only && !amend)))
                die(_("No paths with --include/--only does not make sense."));
@@ -1228,14 +1228,14 @@ int cmd_status(int argc, const char **argv, const char *prefix)
                OPT_SET_INT(0, "long", &status_format,
                            N_("show status in long format (default)"),
                            STATUS_FORMAT_LONG),
-               OPT_BOOLEAN('z', "null", &s.null_termination,
-                           N_("terminate entries with NUL")),
+               OPT_BOOL('z', "null", &s.null_termination,
+                        N_("terminate entries with NUL")),
                { OPTION_STRING, 'u', "untracked-files", &untracked_files_arg,
                  N_("mode"),
                  N_("show untracked files, optional modes: all, normal, no. (Default: all)"),
                  PARSE_OPT_OPTARG, NULL, (intptr_t)"all" },
-               OPT_BOOLEAN(0, "ignored", &show_ignored_in_status,
-                           N_("show ignored files")),
+               OPT_BOOL(0, "ignored", &show_ignored_in_status,
+                        N_("show ignored files")),
                { OPTION_STRING, 0, "ignore-submodules", &ignore_submodule_arg, N_("when"),
                  N_("ignore changes to submodules, optional when: all, dirty, untracked. (Default: all)"),
                  PARSE_OPT_OPTARG, NULL, (intptr_t)"all" },
@@ -1434,24 +1434,24 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
                OPT_STRING('C', "reuse-message", &use_message, N_("commit"), N_("reuse message from specified commit")),
                OPT_STRING(0, "fixup", &fixup_message, N_("commit"), N_("use autosquash formatted message to fixup specified commit")),
                OPT_STRING(0, "squash", &squash_message, N_("commit"), N_("use autosquash formatted message to squash specified commit")),
-               OPT_BOOLEAN(0, "reset-author", &renew_authorship, N_("the commit is authored by me now (used with -C/-c/--amend)")),
-               OPT_BOOLEAN('s', "signoff", &signoff, N_("add Signed-off-by:")),
+               OPT_BOOL(0, "reset-author", &renew_authorship, N_("the commit is authored by me now (used with -C/-c/--amend)")),
+               OPT_BOOL('s', "signoff", &signoff, N_("add Signed-off-by:")),
                OPT_FILENAME('t', "template", &template_file, N_("use specified template file")),
                OPT_BOOL('e', "edit", &edit_flag, N_("force edit of commit")),
                OPT_STRING(0, "cleanup", &cleanup_arg, N_("default"), N_("how to strip spaces and #comments from message")),
-               OPT_BOOLEAN(0, "status", &include_status, N_("include status in commit message template")),
+               OPT_BOOL(0, "status", &include_status, N_("include status in commit message template")),
                { OPTION_STRING, 'S', "gpg-sign", &sign_commit, N_("key id"),
                  N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
                /* end commit message options */
 
                OPT_GROUP(N_("Commit contents options")),
-               OPT_BOOLEAN('a', "all", &all, N_("commit all changed files")),
-               OPT_BOOLEAN('i', "include", &also, N_("add specified files to index for commit")),
-               OPT_BOOLEAN(0, "interactive", &interactive, N_("interactively add files")),
-               OPT_BOOLEAN('p', "patch", &patch_interactive, N_("interactively add changes")),
-               OPT_BOOLEAN('o', "only", &only, N_("commit only specified files")),
-               OPT_BOOLEAN('n', "no-verify", &no_verify, N_("bypass pre-commit hook")),
-               OPT_BOOLEAN(0, "dry-run", &dry_run, N_("show what would be committed")),
+               OPT_BOOL('a', "all", &all, N_("commit all changed files")),
+               OPT_BOOL('i', "include", &also, N_("add specified files to index for commit")),
+               OPT_BOOL(0, "interactive", &interactive, N_("interactively add files")),
+               OPT_BOOL('p', "patch", &patch_interactive, N_("interactively add changes")),
+               OPT_BOOL('o', "only", &only, N_("commit only specified files")),
+               OPT_BOOL('n', "no-verify", &no_verify, N_("bypass pre-commit hook")),
+               OPT_BOOL(0, "dry-run", &dry_run, N_("show what would be committed")),
                OPT_SET_INT(0, "short", &status_format, N_("show status concisely"),
                            STATUS_FORMAT_SHORT),
                OPT_BOOL(0, "branch", &s.show_branch, N_("show branch information")),
@@ -1460,19 +1460,17 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
                OPT_SET_INT(0, "long", &status_format,
                            N_("show status in long format (default)"),
                            STATUS_FORMAT_LONG),
-               OPT_BOOLEAN('z', "null", &s.null_termination,
-                           N_("terminate entries with NUL")),
-               OPT_BOOLEAN(0, "amend", &amend, N_("amend previous commit")),
-               OPT_BOOLEAN(0, "no-post-rewrite", &no_post_rewrite, N_("bypass post-rewrite hook")),
+               OPT_BOOL('z', "null", &s.null_termination,
+                        N_("terminate entries with NUL")),
+               OPT_BOOL(0, "amend", &amend, N_("amend previous commit")),
+               OPT_BOOL(0, "no-post-rewrite", &no_post_rewrite, N_("bypass post-rewrite hook")),
                { OPTION_STRING, 'u', "untracked-files", &untracked_files_arg, N_("mode"), N_("show untracked files, optional modes: all, normal, no. (Default: all)"), PARSE_OPT_OPTARG, NULL, (intptr_t)"all" },
                /* end commit contents options */
 
-               { OPTION_BOOLEAN, 0, "allow-empty", &allow_empty, NULL,
-                 N_("ok to record an empty change"),
-                 PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
-               { OPTION_BOOLEAN, 0, "allow-empty-message", &allow_empty_message, NULL,
-                 N_("ok to record a change with an empty message"),
-                 PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
+               OPT_HIDDEN_BOOL(0, "allow-empty", &allow_empty,
+                               N_("ok to record an empty change")),
+               OPT_HIDDEN_BOOL(0, "allow-empty-message", &allow_empty_message,
+                               N_("ok to record a change with an empty message")),
 
                OPT_END()
        };
index 4010c4320a585d84bdb0914d8a9bbc27d38b7f18..4ab9e9a550ddf06f3822cea78689a60fd802f8d2 100644 (file)
@@ -50,9 +50,9 @@ static int respect_includes = -1;
 
 static struct option builtin_config_options[] = {
        OPT_GROUP(N_("Config file location")),
-       OPT_BOOLEAN(0, "global", &use_global_config, N_("use global config file")),
-       OPT_BOOLEAN(0, "system", &use_system_config, N_("use system config file")),
-       OPT_BOOLEAN(0, "local", &use_local_config, N_("use repository config file")),
+       OPT_BOOL(0, "global", &use_global_config, N_("use global config file")),
+       OPT_BOOL(0, "system", &use_system_config, N_("use system config file")),
+       OPT_BOOL(0, "local", &use_local_config, N_("use repository config file")),
        OPT_STRING('f', "file", &given_config_file, N_("file"), N_("use given config file")),
        OPT_STRING(0, "blob", &given_config_blob, N_("blob-id"), N_("read config from given blob object")),
        OPT_GROUP(N_("Action")),
@@ -75,7 +75,7 @@ static struct option builtin_config_options[] = {
        OPT_BIT(0, "bool-or-int", &types, N_("value is --bool or --int"), TYPE_BOOL_OR_INT),
        OPT_BIT(0, "path", &types, N_("value is a path (file or directory name)"), TYPE_PATH),
        OPT_GROUP(N_("Other")),
-       OPT_BOOLEAN('z', "null", &end_null, N_("terminate values with NUL byte")),
+       OPT_BOOL('z', "null", &end_null, N_("terminate values with NUL byte")),
        OPT_BOOL(0, "includes", &respect_includes, N_("respect include directives on lookup")),
        OPT_END(),
 };
index 7d73722f59b10b5fe302498bb83c9ab3313b89b0..c94e5c30d0851080c49df2edc6d66a739085cf22 100644 (file)
@@ -406,12 +406,12 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
 {
        int contains = 0;
        struct option options[] = {
-               OPT_BOOLEAN(0, "contains",   &contains, N_("find the tag that comes after the commit")),
-               OPT_BOOLEAN(0, "debug",      &debug, N_("debug search strategy on stderr")),
-               OPT_BOOLEAN(0, "all",        &all, N_("use any ref")),
-               OPT_BOOLEAN(0, "tags",       &tags, N_("use any tag, even unannotated")),
-               OPT_BOOLEAN(0, "long",       &longformat, N_("always use long format")),
-               OPT_BOOLEAN(0, "first-parent", &first_parent, N_("only follow first parent")),
+               OPT_BOOL(0, "contains",   &contains, N_("find the tag that comes after the commit")),
+               OPT_BOOL(0, "debug",      &debug, N_("debug search strategy on stderr")),
+               OPT_BOOL(0, "all",        &all, N_("use any ref")),
+               OPT_BOOL(0, "tags",       &tags, N_("use any tag, even unannotated")),
+               OPT_BOOL(0, "long",       &longformat, N_("always use long format")),
+               OPT_BOOL(0, "first-parent", &first_parent, N_("only follow first parent")),
                OPT__ABBREV(&abbrev),
                OPT_SET_INT(0, "exact-match", &max_candidates,
                            N_("only output exact matches"), 0),
@@ -419,11 +419,11 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
                            N_("consider <n> most recent tags (default: 10)")),
                OPT_STRING(0, "match",       &pattern, N_("pattern"),
                           N_("only consider tags matching <pattern>")),
-               OPT_BOOLEAN(0, "always",     &always,
-                          N_("show abbreviated commit object as fallback")),
+               OPT_BOOL(0, "always",        &always,
+                       N_("show abbreviated commit object as fallback")),
                {OPTION_STRING, 0, "dirty",  &dirty, N_("mark"),
-                          N_("append <mark> on dirty working tree (default: \"-dirty\")"),
-                PARSE_OPT_OPTARG, NULL, (intptr_t) "-dirty"},
+                       N_("append <mark> on dirty working tree (default: \"-dirty\")"),
+                       PARSE_OPT_OPTARG, NULL, (intptr_t) "-dirty"},
                OPT_END(),
        };
 
index 8e19058744756e9978eac6244156ed1c27f1e20e..b1b9b5e52aa57b62d5edb5c55f818411e64d9c90 100644 (file)
@@ -674,11 +674,11 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
                             N_("Dump marks to this file")),
                OPT_STRING(0, "import-marks", &import_filename, N_("file"),
                             N_("Import marks from this file")),
-               OPT_BOOLEAN(0, "fake-missing-tagger", &fake_missing_tagger,
-                            N_("Fake a tagger when tags lack one")),
-               OPT_BOOLEAN(0, "full-tree", &full_tree,
-                            N_("Output full tree for each commit")),
-               OPT_BOOLEAN(0, "use-done-feature", &use_done_feature,
+               OPT_BOOL(0, "fake-missing-tagger", &fake_missing_tagger,
+                        N_("Fake a tagger when tags lack one")),
+               OPT_BOOL(0, "full-tree", &full_tree,
+                        N_("Output full tree for each commit")),
+               OPT_BOOL(0, "use-done-feature", &use_done_feature,
                             N_("Use the done feature to terminate the stream")),
                OPT_BOOL(0, "no-data", &no_data, N_("Skip output of blob data")),
                OPT_END()
index d784b2e6947f1b5ace0016d92258e29377e9d1a7..99afed03d4c95c02bc7cff8c568feb7e162439ae 100644 (file)
@@ -56,28 +56,28 @@ static int option_parse_recurse_submodules(const struct option *opt,
 
 static struct option builtin_fetch_options[] = {
        OPT__VERBOSITY(&verbosity),
-       OPT_BOOLEAN(0, "all", &all,
-                   N_("fetch from all remotes")),
-       OPT_BOOLEAN('a', "append", &append,
-                   N_("append to .git/FETCH_HEAD instead of overwriting")),
+       OPT_BOOL(0, "all", &all,
+                N_("fetch from all remotes")),
+       OPT_BOOL('a', "append", &append,
+                N_("append to .git/FETCH_HEAD instead of overwriting")),
        OPT_STRING(0, "upload-pack", &upload_pack, N_("path"),
                   N_("path to upload pack on remote end")),
        OPT__FORCE(&force, N_("force overwrite of local branch")),
-       OPT_BOOLEAN('m', "multiple", &multiple,
-                   N_("fetch from multiple remotes")),
+       OPT_BOOL('m', "multiple", &multiple,
+                N_("fetch from multiple remotes")),
        OPT_SET_INT('t', "tags", &tags,
                    N_("fetch all tags and associated objects"), TAGS_SET),
        OPT_SET_INT('n', NULL, &tags,
                    N_("do not fetch all tags (--no-tags)"), TAGS_UNSET),
-       OPT_BOOLEAN('p', "prune", &prune,
-                   N_("prune remote-tracking branches no longer on remote")),
+       OPT_BOOL('p', "prune", &prune,
+                N_("prune remote-tracking branches no longer on remote")),
        { OPTION_CALLBACK, 0, "recurse-submodules", NULL, N_("on-demand"),
                    N_("control recursive fetching of submodules"),
                    PARSE_OPT_OPTARG, option_parse_recurse_submodules },
-       OPT_BOOLEAN(0, "dry-run", &dry_run,
-                   N_("dry run")),
-       OPT_BOOLEAN('k', "keep", &keep, N_("keep downloaded pack")),
-       OPT_BOOLEAN('u', "update-head-ok", &update_head_ok,
+       OPT_BOOL(0, "dry-run", &dry_run,
+                N_("dry run")),
+       OPT_BOOL('k', "keep", &keep, N_("keep downloaded pack")),
+       OPT_BOOL('u', "update-head-ok", &update_head_ok,
                    N_("allow updating of HEAD ref")),
        OPT_BOOL(0, "progress", &progress, N_("force progress reporting")),
        OPT_STRING(0, "depth", &depth, N_("depth"),
index 9909b6d519f0a7d3d3b53313e7886c9482d98ba5..39fa5e86d4d54e2f9c40d61ae78778078c56f5a8 100644 (file)
@@ -611,15 +611,15 @@ static char const * const fsck_usage[] = {
 
 static struct option fsck_opts[] = {
        OPT__VERBOSE(&verbose, N_("be verbose")),
-       OPT_BOOLEAN(0, "unreachable", &show_unreachable, N_("show unreachable objects")),
+       OPT_BOOL(0, "unreachable", &show_unreachable, N_("show unreachable objects")),
        OPT_BOOL(0, "dangling", &show_dangling, N_("show dangling objects")),
-       OPT_BOOLEAN(0, "tags", &show_tags, N_("report tags")),
-       OPT_BOOLEAN(0, "root", &show_root, N_("report root nodes")),
-       OPT_BOOLEAN(0, "cache", &keep_cache_objects, N_("make index objects head nodes")),
-       OPT_BOOLEAN(0, "reflogs", &include_reflogs, N_("make reflogs head nodes (default)")),
-       OPT_BOOLEAN(0, "full", &check_full, N_("also consider packs and alternate objects")),
-       OPT_BOOLEAN(0, "strict", &check_strict, N_("enable more strict checking")),
-       OPT_BOOLEAN(0, "lost-found", &write_lost_and_found,
+       OPT_BOOL(0, "tags", &show_tags, N_("report tags")),
+       OPT_BOOL(0, "root", &show_root, N_("report root nodes")),
+       OPT_BOOL(0, "cache", &keep_cache_objects, N_("make index objects head nodes")),
+       OPT_BOOL(0, "reflogs", &include_reflogs, N_("make reflogs head nodes (default)")),
+       OPT_BOOL(0, "full", &check_full, N_("also consider packs and alternate objects")),
+       OPT_BOOL(0, "strict", &check_strict, N_("enable more strict checking")),
+       OPT_BOOL(0, "lost-found", &write_lost_and_found,
                                N_("write dangling objects in .git/lost-found")),
        OPT_BOOL(0, "progress", &show_progress, N_("show progress")),
        OPT_END(),
index 6e0d81ab32aa691d24dc86ba30f3bc282bdc2890..891a2c2ecb046dc29b2d9ce8b9d2982084bf9b19 100644 (file)
@@ -236,8 +236,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
                { OPTION_STRING, 0, "prune", &prune_expire, N_("date"),
                        N_("prune unreferenced objects"),
                        PARSE_OPT_OPTARG, NULL, (intptr_t)prune_expire },
-               OPT_BOOLEAN(0, "aggressive", &aggressive, N_("be more thorough (increased runtime)")),
-               OPT_BOOLEAN(0, "auto", &auto_gc, N_("enable auto-gc mode")),
+               OPT_BOOL(0, "aggressive", &aggressive, N_("be more thorough (increased runtime)")),
+               OPT_BOOL(0, "auto", &auto_gc, N_("enable auto-gc mode")),
                OPT_BOOL(0, "force", &force, N_("force running gc even if there may be another gc running")),
                OPT_END()
        };
index d3b3b1db1121b37d5a8d0e440e03273526003774..7877e7755c9674cddf58284ea77d594c81b9982b 100644 (file)
@@ -638,20 +638,20 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
        int pattern_type_arg = GREP_PATTERN_TYPE_UNSPECIFIED;
 
        struct option options[] = {
-               OPT_BOOLEAN(0, "cached", &cached,
+               OPT_BOOL(0, "cached", &cached,
                        N_("search in index instead of in the work tree")),
                OPT_NEGBIT(0, "no-index", &use_index,
                         N_("find in contents not managed by git"), 1),
-               OPT_BOOLEAN(0, "untracked", &untracked,
+               OPT_BOOL(0, "untracked", &untracked,
                        N_("search in both tracked and untracked files")),
                OPT_SET_INT(0, "exclude-standard", &opt_exclude,
                            N_("search also in ignored files"), 1),
                OPT_GROUP(""),
-               OPT_BOOLEAN('v', "invert-match", &opt.invert,
+               OPT_BOOL('v', "invert-match", &opt.invert,
                        N_("show non-matching lines")),
-               OPT_BOOLEAN('i', "ignore-case", &opt.ignore_case,
+               OPT_BOOL('i', "ignore-case", &opt.ignore_case,
                        N_("case insensitive matching")),
-               OPT_BOOLEAN('w', "word-regexp", &opt.word_regexp,
+               OPT_BOOL('w', "word-regexp", &opt.word_regexp,
                        N_("match patterns only at word boundaries")),
                OPT_SET_INT('a', "text", &opt.binary,
                        N_("process binary files as text"), GREP_BINARY_TEXT),
@@ -675,26 +675,26 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                            N_("use Perl-compatible regular expressions"),
                            GREP_PATTERN_TYPE_PCRE),
                OPT_GROUP(""),
-               OPT_BOOLEAN('n', "line-number", &opt.linenum, N_("show line numbers")),
+               OPT_BOOL('n', "line-number", &opt.linenum, N_("show line numbers")),
                OPT_NEGBIT('h', NULL, &opt.pathname, N_("don't show filenames"), 1),
                OPT_BIT('H', NULL, &opt.pathname, N_("show filenames"), 1),
                OPT_NEGBIT(0, "full-name", &opt.relative,
                        N_("show filenames relative to top directory"), 1),
-               OPT_BOOLEAN('l', "files-with-matches", &opt.name_only,
+               OPT_BOOL('l', "files-with-matches", &opt.name_only,
                        N_("show only filenames instead of matching lines")),
-               OPT_BOOLEAN(0, "name-only", &opt.name_only,
+               OPT_BOOL(0, "name-only", &opt.name_only,
                        N_("synonym for --files-with-matches")),
-               OPT_BOOLEAN('L', "files-without-match",
+               OPT_BOOL('L', "files-without-match",
                        &opt.unmatch_name_only,
                        N_("show only the names of files without match")),
-               OPT_BOOLEAN('z', "null", &opt.null_following_name,
+               OPT_BOOL('z', "null", &opt.null_following_name,
                        N_("print NUL after filenames")),
-               OPT_BOOLEAN('c', "count", &opt.count,
+               OPT_BOOL('c', "count", &opt.count,
                        N_("show the number of matches instead of matching lines")),
                OPT__COLOR(&opt.color, N_("highlight matches")),
-               OPT_BOOLEAN(0, "break", &opt.file_break,
+               OPT_BOOL(0, "break", &opt.file_break,
                        N_("print empty line between matches from different files")),
-               OPT_BOOLEAN(0, "heading", &opt.heading,
+               OPT_BOOL(0, "heading", &opt.heading,
                        N_("show filename only once above matches from same file")),
                OPT_GROUP(""),
                OPT_CALLBACK('C', "context", &opt, N_("n"),
@@ -706,9 +706,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                        N_("show <n> context lines after matches")),
                OPT_NUMBER_CALLBACK(&opt, N_("shortcut for -C NUM"),
                        context_callback),
-               OPT_BOOLEAN('p', "show-function", &opt.funcname,
+               OPT_BOOL('p', "show-function", &opt.funcname,
                        N_("show a line with the function name before matches")),
-               OPT_BOOLEAN('W', "function-context", &opt.funcbody,
+               OPT_BOOL('W', "function-context", &opt.funcbody,
                        N_("show the surrounding function")),
                OPT_GROUP(""),
                OPT_CALLBACK('f', NULL, &opt, N_("file"),
@@ -718,7 +718,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                { OPTION_CALLBACK, 0, "and", &opt, NULL,
                  N_("combine patterns specified with -e"),
                  PARSE_OPT_NOARG | PARSE_OPT_NONEG, and_callback },
-               OPT_BOOLEAN(0, "or", &dummy, ""),
+               OPT_BOOL(0, "or", &dummy, ""),
                { OPTION_CALLBACK, 0, "not", &opt, NULL, "",
                  PARSE_OPT_NOARG | PARSE_OPT_NONEG, not_callback },
                { OPTION_CALLBACK, '(', NULL, &opt, NULL, "",
@@ -729,7 +729,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                  close_callback },
                OPT__QUIET(&opt.status_only,
                           N_("indicate hit with exit status without output")),
-               OPT_BOOLEAN(0, "all-match", &opt.all_match,
+               OPT_BOOL(0, "all-match", &opt.all_match,
                        N_("show only matches from files that match all patterns")),
                { OPTION_SET_INT, 0, "debug", &opt.debug, NULL,
                  N_("show parse tree for grep expression"),
@@ -738,8 +738,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                { OPTION_STRING, 'O', "open-files-in-pager", &show_in_pager,
                        N_("pager"), N_("show matching files in the pager"),
                        PARSE_OPT_OPTARG, NULL, (intptr_t)default_pager },
-               OPT_BOOLEAN(0, "ext-grep", &external_grep_allowed__ignored,
-                           N_("allow calling of grep(1) (ignored by this build)")),
+               OPT_BOOL(0, "ext-grep", &external_grep_allowed__ignored,
+                        N_("allow calling of grep(1) (ignored by this build)")),
                { OPTION_CALLBACK, 0, "help-all", &options, NULL, N_("show usage"),
                  PARSE_OPT_HIDDEN | PARSE_OPT_NOARG, help_callback },
                OPT_END()
index 8d184f1a99120b1ebccac4f5e1d4fdb0a692b3c9..d7fcf4c13c7e0f0855fba51c6b58d2b06c99984e 100644 (file)
@@ -70,10 +70,10 @@ static const char *vpath;
 
 static const struct option hash_object_options[] = {
        OPT_STRING('t', NULL, &type, N_("type"), N_("object type")),
-       OPT_BOOLEAN('w', NULL, &write_object, N_("write the object into the object database")),
-       OPT_BOOLEAN( 0 , "stdin", &hashstdin, N_("read the object from stdin")),
-       OPT_BOOLEAN( 0 , "stdin-paths", &stdin_paths, N_("read file names from stdin")),
-       OPT_BOOLEAN( 0 , "no-filters", &no_filters, N_("store file as is without filters")),
+       OPT_BOOL('w', NULL, &write_object, N_("write the object into the object database")),
+       OPT_COUNTUP( 0 , "stdin", &hashstdin, N_("read the object from stdin")),
+       OPT_BOOL( 0 , "stdin-paths", &stdin_paths, N_("read file names from stdin")),
+       OPT_BOOL( 0 , "no-filters", &no_filters, N_("store file as is without filters")),
        OPT_STRING( 0 , "path", &vpath, N_("file"), N_("process file as it were from this path")),
        OPT_END()
 };
index 2625f9881ad836d1a3e303f4c159d6b76a3ae04f..ed4dec406e76fdda71e2882ae0b02f79c9d57c81 100644 (file)
@@ -121,7 +121,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
        static struct line_opt_callback_data line_cb = {NULL, NULL, STRING_LIST_INIT_DUP};
 
        const struct option builtin_log_options[] = {
-               OPT_BOOL(0, "quiet", &quiet, N_("suppress diff output")),
+               OPT__QUIET(&quiet, N_("suppress diff output")),
                OPT_BOOL(0, "source", &source, N_("show source")),
                OPT_BOOL(0, "use-mailmap", &mailmap, N_("Use mail map file")),
                { OPTION_CALLBACK, 0, "decorate", NULL, NULL, N_("decorate options"),
@@ -1179,13 +1179,13 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                { OPTION_CALLBACK, 'k', "keep-subject", &rev, NULL,
                            N_("don't strip/add [PATCH]"),
                            PARSE_OPT_NOARG | PARSE_OPT_NONEG, keep_callback },
-               OPT_BOOLEAN(0, "no-binary", &no_binary_diff,
-                           N_("don't output binary diffs")),
-               OPT_BOOLEAN(0, "ignore-if-in-upstream", &ignore_if_in_upstream,
-                           N_("don't include a patch matching a commit upstream")),
-               { OPTION_BOOLEAN, 'p', "no-stat", &use_patch_format, NULL,
+               OPT_BOOL(0, "no-binary", &no_binary_diff,
+                        N_("don't output binary diffs")),
+               OPT_BOOL(0, "ignore-if-in-upstream", &ignore_if_in_upstream,
+                        N_("don't include a patch matching a commit upstream")),
+               { OPTION_SET_INT, 'p', "no-stat", &use_patch_format, NULL,
                  N_("show patch format instead of default (patch + stat)"),
-                 PARSE_OPT_NONEG | PARSE_OPT_NOARG },
+                 PARSE_OPT_NONEG | PARSE_OPT_NOARG, NULL, 1},
                OPT_GROUP(N_("Messaging")),
                { OPTION_CALLBACK, 0, "add-header", NULL, N_("header"),
                            N_("add email header"), 0, header_callback },
@@ -1210,8 +1210,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                            PARSE_OPT_OPTARG, thread_callback },
                OPT_STRING(0, "signature", &signature, N_("signature"),
                            N_("add a signature")),
-               OPT_BOOLEAN(0, "quiet", &quiet,
-                           N_("don't print the patch filenames")),
+               OPT__QUIET(&quiet, N_("don't print the patch filenames")),
                OPT_END()
        };
 
index 5cf3e313700e4cbcd26ae1a9f3f99f2819e40702..963ccc974245bbb68d0fefd4ec6e97d2ffaaae54 100644 (file)
@@ -461,24 +461,24 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
                { OPTION_CALLBACK, 'z', NULL, NULL, NULL,
                        N_("paths are separated with NUL character"),
                        PARSE_OPT_NOARG, option_parse_z },
-               OPT_BOOLEAN('t', NULL, &show_tag,
+               OPT_BOOL('t', NULL, &show_tag,
                        N_("identify the file status with tags")),
-               OPT_BOOLEAN('v', NULL, &show_valid_bit,
+               OPT_BOOL('v', NULL, &show_valid_bit,
                        N_("use lowercase letters for 'assume unchanged' files")),
-               OPT_BOOLEAN('c', "cached", &show_cached,
+               OPT_BOOL('c', "cached", &show_cached,
                        N_("show cached files in the output (default)")),
-               OPT_BOOLEAN('d', "deleted", &show_deleted,
+               OPT_BOOL('d', "deleted", &show_deleted,
                        N_("show deleted files in the output")),
-               OPT_BOOLEAN('m', "modified", &show_modified,
+               OPT_BOOL('m', "modified", &show_modified,
                        N_("show modified files in the output")),
-               OPT_BOOLEAN('o', "others", &show_others,
+               OPT_BOOL('o', "others", &show_others,
                        N_("show other files in the output")),
                OPT_BIT('i', "ignored", &dir.flags,
                        N_("show ignored files in the output"),
                        DIR_SHOW_IGNORED),
-               OPT_BOOLEAN('s', "stage", &show_stage,
+               OPT_BOOL('s', "stage", &show_stage,
                        N_("show staged contents' object name in the output")),
-               OPT_BOOLEAN('k', "killed", &show_killed,
+               OPT_BOOL('k', "killed", &show_killed,
                        N_("show files on the filesystem that need to be removed")),
                OPT_BIT(0, "directory", &dir.flags,
                        N_("show 'other' directories' name only"),
@@ -486,9 +486,9 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
                OPT_NEGBIT(0, "empty-directory", &dir.flags,
                        N_("don't show empty directories"),
                        DIR_HIDE_EMPTY_DIRECTORIES),
-               OPT_BOOLEAN('u', "unmerged", &show_unmerged,
+               OPT_BOOL('u', "unmerged", &show_unmerged,
                        N_("show unmerged files in the output")),
-               OPT_BOOLEAN(0, "resolve-undo", &show_resolve_undo,
+               OPT_BOOL(0, "resolve-undo", &show_resolve_undo,
                            N_("show resolve-undo information")),
                { OPTION_CALLBACK, 'x', "exclude", &exclude_list, N_("pattern"),
                        N_("skip files matching pattern"),
@@ -504,12 +504,12 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
                { OPTION_SET_INT, 0, "full-name", &prefix_len, NULL,
                        N_("make the output relative to the project top directory"),
                        PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL },
-               OPT_BOOLEAN(0, "error-unmatch", &error_unmatch,
+               OPT_BOOL(0, "error-unmatch", &error_unmatch,
                        N_("if any <file> is not in the index, treat this as an error")),
                OPT_STRING(0, "with-tree", &with_tree, N_("tree-ish"),
                        N_("pretend that paths removed since <tree-ish> are still present")),
                OPT__ABBREV(&abbrev),
-               OPT_BOOLEAN(0, "debug", &debug_mode, N_("show debugging data")),
+               OPT_BOOL(0, "debug", &debug_mode, N_("show debugging data")),
                OPT_END()
        };
 
index fb76e38d849fc6f7b9cc1a534f62efb605a3655c..de88563edfdae562321bad7a91e8c5fe286e8922 100644 (file)
@@ -138,9 +138,9 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
                        LS_NAME_ONLY),
                OPT_SET_INT(0, "full-name", &chomp_prefix,
                            N_("use full path names"), 0),
-               OPT_BOOLEAN(0, "full-tree", &full_tree,
-                           N_("list entire tree; not just current directory "
-                              "(implies --full-name)")),
+               OPT_BOOL(0, "full-tree", &full_tree,
+                        N_("list entire tree; not just current directory "
+                           "(implies --full-name)")),
                OPT__ABBREV(&abbrev),
                OPT_END()
        };
index 0c4cd2f9f792cdf47cecf3401eb2bf7c676f7f6e..e88eb93f143ef5883b3e5f8f069fd13f70ff7abf 100644 (file)
@@ -95,11 +95,11 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix)
        int is_ancestor = 0;
 
        struct option options[] = {
-               OPT_BOOLEAN('a', "all", &show_all, N_("output all common ancestors")),
-               OPT_BOOLEAN(0, "octopus", &octopus, N_("find ancestors for a single n-way merge")),
-               OPT_BOOLEAN(0, "independent", &reduce, N_("list revs not reachable from others")),
-               OPT_BOOLEAN(0, "is-ancestor", &is_ancestor,
-                           N_("is the first one ancestor of the other?")),
+               OPT_BOOL('a', "all", &show_all, N_("output all common ancestors")),
+               OPT_BOOL(0, "octopus", &octopus, N_("find ancestors for a single n-way merge")),
+               OPT_BOOL(0, "independent", &reduce, N_("list revs not reachable from others")),
+               OPT_BOOL(0, "is-ancestor", &is_ancestor,
+                        N_("is the first one ancestor of the other?")),
                OPT_END()
        };
 
index c0570f24072a8e29a13e00a2f4fe1b5054ebac7c..844f84f40bf0f8b9d95f4e9f0496c010386a9fb8 100644 (file)
@@ -30,7 +30,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
        int quiet = 0;
        int prefixlen = 0;
        struct option options[] = {
-               OPT_BOOLEAN('p', "stdout", &to_stdout, N_("send results to standard output")),
+               OPT_BOOL('p', "stdout", &to_stdout, N_("send results to standard output")),
                OPT_SET_INT(0, "diff3", &xmp.style, N_("use a diff3 based merge"), XDL_MERGE_DIFF3),
                OPT_SET_INT(0, "ours", &xmp.favor, N_("for conflicts, use our version"),
                            XDL_MERGE_FAVOR_OURS),
index 34a6166b520c8ede9973fbf497b21ac6ecb761ad..a8cf4a248492fc793c433e61e025fb7f3b3eacfe 100644 (file)
@@ -197,15 +197,15 @@ static struct option builtin_merge_options[] = {
        { OPTION_CALLBACK, 'n', NULL, NULL, NULL,
                N_("do not show a diffstat at the end of the merge"),
                PARSE_OPT_NOARG, option_parse_n },
-       OPT_BOOLEAN(0, "stat", &show_diffstat,
+       OPT_BOOL(0, "stat", &show_diffstat,
                N_("show a diffstat at the end of the merge")),
-       OPT_BOOLEAN(0, "summary", &show_diffstat, N_("(synonym to --stat)")),
+       OPT_BOOL(0, "summary", &show_diffstat, N_("(synonym to --stat)")),
        { OPTION_INTEGER, 0, "log", &shortlog_len, N_("n"),
          N_("add (at most <n>) entries from shortlog to merge commit message"),
          PARSE_OPT_OPTARG, NULL, DEFAULT_MERGE_LOG_LEN },
-       OPT_BOOLEAN(0, "squash", &squash,
+       OPT_BOOL(0, "squash", &squash,
                N_("create a single commit instead of doing a merge")),
-       OPT_BOOLEAN(0, "commit", &option_commit,
+       OPT_BOOL(0, "commit", &option_commit,
                N_("perform a commit if the merge succeeds (default)")),
        OPT_BOOL('e', "edit", &option_edit,
                N_("edit message before committing")),
@@ -224,12 +224,12 @@ static struct option builtin_merge_options[] = {
                N_("merge commit message (for a non-fast-forward merge)"),
                option_parse_message),
        OPT__VERBOSITY(&verbosity),
-       OPT_BOOLEAN(0, "abort", &abort_current_merge,
+       OPT_BOOL(0, "abort", &abort_current_merge,
                N_("abort the current in-progress merge")),
        OPT_SET_INT(0, "progress", &show_progress, N_("force progress reporting"), 1),
        { OPTION_STRING, 'S', "gpg-sign", &sign_commit, N_("key id"),
          N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
-       OPT_BOOLEAN(0, "overwrite-ignore", &overwrite_ignore, N_("update ignored files (default)")),
+       OPT_BOOL(0, "overwrite-ignore", &overwrite_ignore, N_("update ignored files (default)")),
        OPT_END()
 };
 
index 034fec92a11d79f28d80171ca86394817084ee09..be6fa77d0481c60b82a22ca01e9b8714d9849e71 100644 (file)
@@ -62,7 +62,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                OPT__VERBOSE(&verbose, N_("be verbose")),
                OPT__DRY_RUN(&show_only, N_("dry run")),
                OPT__FORCE(&force, N_("force move/rename even if target exists")),
-               OPT_BOOLEAN('k', NULL, &ignore_errors, N_("skip move/rename errors")),
+               OPT_BOOL('k', NULL, &ignore_errors, N_("skip move/rename errors")),
                OPT_END(),
        };
        const char **source, **destination, **dest_path;
index 0aaa19e4abeb462b2f1d05d5e03aa29bee810db8..20fcf8c696700993617649da77e5bbf6b416498a 100644 (file)
@@ -310,15 +310,15 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
        int all = 0, transform_stdin = 0, allow_undefined = 1, always = 0, peel_tag = 0;
        struct name_ref_data data = { 0, 0, NULL };
        struct option opts[] = {
-               OPT_BOOLEAN(0, "name-only", &data.name_only, N_("print only names (no SHA-1)")),
-               OPT_BOOLEAN(0, "tags", &data.tags_only, N_("only use tags to name the commits")),
+               OPT_BOOL(0, "name-only", &data.name_only, N_("print only names (no SHA-1)")),
+               OPT_BOOL(0, "tags", &data.tags_only, N_("only use tags to name the commits")),
                OPT_STRING(0, "refs", &data.ref_filter, N_("pattern"),
                                   N_("only use refs matching <pattern>")),
                OPT_GROUP(""),
-               OPT_BOOLEAN(0, "all", &all, N_("list all commits reachable from all refs")),
-               OPT_BOOLEAN(0, "stdin", &transform_stdin, N_("read from stdin")),
-               OPT_BOOLEAN(0, "undefined", &allow_undefined, N_("allow to print `undefined` names")),
-               OPT_BOOLEAN(0, "always",     &always,
+               OPT_BOOL(0, "all", &all, N_("list all commits reachable from all refs")),
+               OPT_BOOL(0, "stdin", &transform_stdin, N_("read from stdin")),
+               OPT_BOOL(0, "undefined", &allow_undefined, N_("allow to print `undefined` names (default)")),
+               OPT_BOOL(0, "always",     &always,
                           N_("show abbreviated commit object as fallback")),
                {
                        /* A Hidden OPT_BOOL */
@@ -331,7 +331,7 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
 
        git_config(git_default_config, NULL);
        argc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0);
-       if (!!all + !!transform_stdin + !!argc > 1) {
+       if (all + transform_stdin + !!argc > 1) {
                error("Specify either a list, or --all, not both!");
                usage_with_options(name_rev_usage, opts);
        }
index e4100c49820306b881a20db4bb3af7c13f12c019..d459e23c4225ae0f8084cfd756563c2b7ab85a60 100644 (file)
@@ -483,7 +483,7 @@ static int copy(int argc, const char **argv, const char *prefix)
        const char *rewrite_cmd = NULL;
        struct option options[] = {
                OPT__FORCE(&force, N_("replace existing notes")),
-               OPT_BOOLEAN(0, "stdin", &from_stdin, N_("read objects from stdin")),
+               OPT_BOOL(0, "stdin", &from_stdin, N_("read objects from stdin")),
                OPT_STRING(0, "for-rewrite", &rewrite_cmd, N_("command"),
                           N_("load rewriting config for <command> (implies "
                              "--stdin)")),
@@ -739,13 +739,13 @@ static int merge(int argc, const char **argv, const char *prefix)
                           N_("resolve notes conflicts using the given strategy "
                              "(manual/ours/theirs/union/cat_sort_uniq)")),
                OPT_GROUP(N_("Committing unmerged notes")),
-               { OPTION_BOOLEAN, 0, "commit", &do_commit, NULL,
+               { OPTION_SET_INT, 0, "commit", &do_commit, NULL,
                        N_("finalize notes merge by committing unmerged notes"),
-                       PARSE_OPT_NOARG | PARSE_OPT_NONEG },
+                       PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, 1},
                OPT_GROUP(N_("Aborting notes merge resolution")),
-               { OPTION_BOOLEAN, 0, "abort", &do_abort, NULL,
+               { OPTION_SET_INT, 0, "abort", &do_abort, NULL,
                        N_("abort notes merge"),
-                       PARSE_OPT_NOARG | PARSE_OPT_NONEG },
+                       PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, 1},
                OPT_END()
        };
 
@@ -853,7 +853,7 @@ static int remove_cmd(int argc, const char **argv, const char *prefix)
                OPT_BIT(0, "ignore-missing", &flag,
                        N_("attempt to remove non-existent note is not an error"),
                        IGNORE_MISSING),
-               OPT_BOOLEAN(0, "stdin", &from_stdin,
+               OPT_BOOL(0, "stdin", &from_stdin,
                            N_("read object names from the standard input")),
                OPT_END()
        };
index 04f0eaf179044dce1e87137978bcbecca18f3527..aff507c9f601f4c783ee16a08621695edd9b5ecb 100644 (file)
@@ -446,15 +446,15 @@ int cmd_push(int argc, const char **argv, const char *prefix)
                OPT_BIT( 0 , "all", &flags, N_("push all refs"), TRANSPORT_PUSH_ALL),
                OPT_BIT( 0 , "mirror", &flags, N_("mirror all refs"),
                            (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE)),
-               OPT_BOOLEAN( 0, "delete", &deleterefs, N_("delete refs")),
-               OPT_BOOLEAN( 0 , "tags", &tags, N_("push tags (can't be used with --all or --mirror)")),
+               OPT_BOOL( 0, "delete", &deleterefs, N_("delete refs")),
+               OPT_BOOL( 0 , "tags", &tags, N_("push tags (can't be used with --all or --mirror)")),
                OPT_BIT('n' , "dry-run", &flags, N_("dry run"), TRANSPORT_PUSH_DRY_RUN),
                OPT_BIT( 0,  "porcelain", &flags, N_("machine-readable output"), TRANSPORT_PUSH_PORCELAIN),
                OPT_BIT('f', "force", &flags, N_("force updates"), TRANSPORT_PUSH_FORCE),
                { OPTION_CALLBACK, 0, "recurse-submodules", &flags, N_("check"),
                        N_("control recursive pushing of submodules"),
                        PARSE_OPT_OPTARG, option_parse_recurse_submodules },
-               OPT_BOOLEAN( 0 , "thin", &thin, N_("use thin pack")),
+               OPT_BOOL( 0 , "thin", &thin, N_("use thin pack")),
                OPT_STRING( 0 , "receive-pack", &receivepack, "receive-pack", N_("receive pack program")),
                OPT_STRING( 0 , "exec", &receivepack, "receive-pack", N_("receive pack program")),
                OPT_BIT('u', "set-upstream", &flags, N_("set upstream for git pull/status"),
index 5e54d367b82cd91dbba70e2570dc620a3a13cd21..eaac3e20124c48456faab48a6529ed281075ee25 100644 (file)
@@ -160,7 +160,7 @@ static int add(int argc, const char **argv)
        int i;
 
        struct option options[] = {
-               OPT_BOOLEAN('f', "fetch", &fetch, N_("fetch the remote branches")),
+               OPT_BOOL('f', "fetch", &fetch, N_("fetch the remote branches")),
                OPT_SET_INT(0, "tags", &fetch_tags,
                            N_("import all tags and associated objects when fetching"),
                            TAGS_SET),
@@ -1088,7 +1088,7 @@ static int show(int argc, const char **argv)
 {
        int no_query = 0, result = 0, query_flag = 0;
        struct option options[] = {
-               OPT_BOOLEAN('n', NULL, &no_query, N_("do not query remotes")),
+               OPT_BOOL('n', NULL, &no_query, N_("do not query remotes")),
                OPT_END()
        };
        struct ref_states states;
@@ -1195,10 +1195,10 @@ static int set_head(int argc, const char **argv)
        char *head_name = NULL;
 
        struct option options[] = {
-               OPT_BOOLEAN('a', "auto", &opt_a,
-                           N_("set refs/remotes/<name>/HEAD according to remote")),
-               OPT_BOOLEAN('d', "delete", &opt_d,
-                           N_("delete refs/remotes/<name>/HEAD")),
+               OPT_BOOL('a', "auto", &opt_a,
+                        N_("set refs/remotes/<name>/HEAD according to remote")),
+               OPT_BOOL('d', "delete", &opt_d,
+                        N_("delete refs/remotes/<name>/HEAD")),
                OPT_END()
        };
        argc = parse_options(argc, argv, NULL, options, builtin_remote_sethead_usage,
@@ -1317,8 +1317,8 @@ static int update(int argc, const char **argv)
 {
        int i, prune = 0;
        struct option options[] = {
-               OPT_BOOLEAN('p', "prune", &prune,
-                           N_("prune remotes after fetching")),
+               OPT_BOOL('p', "prune", &prune,
+                        N_("prune remotes after fetching")),
                OPT_END()
        };
        const char **fetch_argv;
@@ -1404,7 +1404,7 @@ static int set_branches(int argc, const char **argv)
 {
        int add_mode = 0;
        struct option options[] = {
-               OPT_BOOLEAN('\0', "add", &add_mode, N_("add branch")),
+               OPT_BOOL('\0', "add", &add_mode, N_("add branch")),
                OPT_END()
        };
 
@@ -1432,11 +1432,11 @@ static int set_url(int argc, const char **argv)
        int urlset_nr;
        struct strbuf name_buf = STRBUF_INIT;
        struct option options[] = {
-               OPT_BOOLEAN('\0', "push", &push_mode,
-                           N_("manipulate push URLs")),
-               OPT_BOOLEAN('\0', "add", &add_mode,
-                           N_("add URL")),
-               OPT_BOOLEAN('\0', "delete", &delete_mode,
+               OPT_BOOL('\0', "push", &push_mode,
+                        N_("manipulate push URLs")),
+               OPT_BOOL('\0', "add", &add_mode,
+                        N_("add URL")),
+               OPT_BOOL('\0', "delete", &delete_mode,
                            N_("delete URLs")),
                OPT_END()
        };
index 59d31152d0068dd4a542d2c8e076c629d508500f..11b0a55ae7f6e3d1a04eeb4026b151144d0315ba 100644 (file)
@@ -118,9 +118,9 @@ int cmd_replace(int argc, const char **argv, const char *prefix)
 {
        int list = 0, delete = 0, force = 0;
        struct option options[] = {
-               OPT_BOOLEAN('l', NULL, &list, N_("list replace refs")),
-               OPT_BOOLEAN('d', NULL, &delete, N_("delete replace refs")),
-               OPT_BOOLEAN('f', NULL, &force, N_("replace the ref if it exists")),
+               OPT_BOOL('l', NULL, &list, N_("list replace refs")),
+               OPT_BOOL('d', NULL, &delete, N_("delete replace refs")),
+               OPT_BOOL('f', NULL, &force, N_("replace the ref if it exists")),
                OPT_END()
        };
 
index afa6e020e83ebac739db474c278e44bc22079848..090581564b2a71d8360c1bc112ba39ceaa96825c 100644 (file)
@@ -258,7 +258,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
                                N_("reset HEAD, index and working tree"), MERGE),
                OPT_SET_INT(0, "keep", &reset_type,
                                N_("reset HEAD but keep local changes"), KEEP),
-               OPT_BOOLEAN('p', "patch", &patch_mode, N_("select hunks interactively")),
+               OPT_BOOL('p', "patch", &patch_mode, N_("select hunks interactively")),
                OPT_END()
        };
 
index c9aa28fd75c6e4f995906c584ec185617ec76856..c76b89dc5bcccb42f7c2613072b1093a58c7d21c 100644 (file)
@@ -346,9 +346,9 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
                NULL
        };
        static struct option parseopt_opts[] = {
-               OPT_BOOLEAN(0, "keep-dashdash", &keep_dashdash,
+               OPT_BOOL(0, "keep-dashdash", &keep_dashdash,
                                        N_("keep the `--` passed as an arg")),
-               OPT_BOOLEAN(0, "stop-at-non-option", &stop_at_non_option,
+               OPT_BOOL(0, "stop-at-non-option", &stop_at_non_option,
                                        N_("stop parsing after the "
                                           "first non-option argument")),
                OPT_END(),
index 1d2648b756907f467edbe1e206535009df4c65e8..8e87acd12e622957df6bc0a93903898361149f91 100644 (file)
@@ -71,44 +71,19 @@ static void verify_opt_compatible(const char *me, const char *base_opt, ...)
                die(_("%s: %s cannot be used with %s"), me, this_opt, base_opt);
 }
 
-LAST_ARG_MUST_BE_NULL
-static void verify_opt_mutually_compatible(const char *me, ...)
-{
-       const char *opt1, *opt2 = NULL;
-       va_list ap;
-
-       va_start(ap, me);
-       while ((opt1 = va_arg(ap, const char *))) {
-               if (va_arg(ap, int))
-                       break;
-       }
-       if (opt1) {
-               while ((opt2 = va_arg(ap, const char *))) {
-                       if (va_arg(ap, int))
-                               break;
-               }
-       }
-       va_end(ap);
-
-       if (opt1 && opt2)
-               die(_("%s: %s cannot be used with %s"), me, opt1, opt2);
-}
-
 static void parse_args(int argc, const char **argv, struct replay_opts *opts)
 {
        const char * const * usage_str = revert_or_cherry_pick_usage(opts);
        const char *me = action_name(opts);
-       int remove_state = 0;
-       int contin = 0;
-       int rollback = 0;
+       int cmd = 0;
        struct option options[] = {
-               OPT_BOOLEAN(0, "quit", &remove_state, N_("end revert or cherry-pick sequence")),
-               OPT_BOOLEAN(0, "continue", &contin, N_("resume revert or cherry-pick sequence")),
-               OPT_BOOLEAN(0, "abort", &rollback, N_("cancel revert or cherry-pick sequence")),
-               OPT_BOOLEAN('n', "no-commit", &opts->no_commit, N_("don't automatically commit")),
-               OPT_BOOLEAN('e', "edit", &opts->edit, N_("edit the commit message")),
+               OPT_CMDMODE(0, "quit", &cmd, N_("end revert or cherry-pick sequence"), 'q'),
+               OPT_CMDMODE(0, "continue", &cmd, N_("resume revert or cherry-pick sequence"), 'c'),
+               OPT_CMDMODE(0, "abort", &cmd, N_("cancel revert or cherry-pick sequence"), 'a'),
+               OPT_BOOL('n', "no-commit", &opts->no_commit, N_("don't automatically commit")),
+               OPT_BOOL('e', "edit", &opts->edit, N_("edit the commit message")),
                OPT_NOOP_NOARG('r', NULL),
-               OPT_BOOLEAN('s', "signoff", &opts->signoff, N_("add Signed-off-by:")),
+               OPT_BOOL('s', "signoff", &opts->signoff, N_("add Signed-off-by:")),
                OPT_INTEGER('m', "mainline", &opts->mainline, N_("parent number")),
                OPT_RERERE_AUTOUPDATE(&opts->allow_rerere_auto),
                OPT_STRING(0, "strategy", &opts->strategy, N_("strategy"), N_("merge strategy")),
@@ -124,11 +99,11 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)
 
        if (opts->action == REPLAY_PICK) {
                struct option cp_extra[] = {
-                       OPT_BOOLEAN('x', NULL, &opts->record_origin, N_("append commit name")),
-                       OPT_BOOLEAN(0, "ff", &opts->allow_ff, N_("allow fast-forward")),
-                       OPT_BOOLEAN(0, "allow-empty", &opts->allow_empty, N_("preserve initially empty commits")),
-                       OPT_BOOLEAN(0, "allow-empty-message", &opts->allow_empty_message, N_("allow commits with empty messages")),
-                       OPT_BOOLEAN(0, "keep-redundant-commits", &opts->keep_redundant_commits, N_("keep redundant, empty commits")),
+                       OPT_BOOL('x', NULL, &opts->record_origin, N_("append commit name")),
+                       OPT_BOOL(0, "ff", &opts->allow_ff, N_("allow fast-forward")),
+                       OPT_BOOL(0, "allow-empty", &opts->allow_empty, N_("preserve initially empty commits")),
+                       OPT_BOOL(0, "allow-empty-message", &opts->allow_empty_message, N_("allow commits with empty messages")),
+                       OPT_BOOL(0, "keep-redundant-commits", &opts->keep_redundant_commits, N_("keep redundant, empty commits")),
                        OPT_END(),
                };
                if (parse_options_concat(options, ARRAY_SIZE(options), cp_extra))
@@ -139,23 +114,16 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)
                        PARSE_OPT_KEEP_ARGV0 |
                        PARSE_OPT_KEEP_UNKNOWN);
 
-       /* Check for incompatible subcommands */
-       verify_opt_mutually_compatible(me,
-                               "--quit", remove_state,
-                               "--continue", contin,
-                               "--abort", rollback,
-                               NULL);
-
        /* implies allow_empty */
        if (opts->keep_redundant_commits)
                opts->allow_empty = 1;
 
        /* Set the subcommand */
-       if (remove_state)
+       if (cmd == 'q')
                opts->subcommand = REPLAY_REMOVE_STATE;
-       else if (contin)
+       else if (cmd == 'c')
                opts->subcommand = REPLAY_CONTINUE;
-       else if (rollback)
+       else if (cmd == 'a')
                opts->subcommand = REPLAY_ROLLBACK;
        else
                opts->subcommand = REPLAY_NONE;
index d00eaf86d56c9efbd436458d46937b8b2c855ce4..18bf2189992439caafb66b103df9fbe3e76c4e37 100644 (file)
@@ -267,10 +267,10 @@ static int ignore_unmatch = 0;
 static struct option builtin_rm_options[] = {
        OPT__DRY_RUN(&show_only, N_("dry run")),
        OPT__QUIET(&quiet, N_("do not list removed files")),
-       OPT_BOOLEAN( 0 , "cached",         &index_only, N_("only remove from the index")),
+       OPT_BOOL( 0 , "cached",         &index_only, N_("only remove from the index")),
        OPT__FORCE(&force, N_("override the up-to-date check")),
-       OPT_BOOLEAN('r', NULL,             &recursive,  N_("allow recursive removal")),
-       OPT_BOOLEAN( 0 , "ignore-unmatch", &ignore_unmatch,
+       OPT_BOOL('r', NULL,             &recursive,  N_("allow recursive removal")),
+       OPT_BOOL( 0 , "ignore-unmatch", &ignore_unmatch,
                                N_("exit with a zero status even if nothing matched")),
        OPT_END(),
 };
index 1434f8fee487751abe069250c611bdaed2fa5857..ae73d17b6cbc22f3a7eb30aff5a14cda27c5876c 100644 (file)
@@ -224,12 +224,12 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)
        int nongit = !startup_info->have_repository;
 
        static const struct option options[] = {
-               OPT_BOOLEAN('n', "numbered", &log.sort_by_number,
-                           N_("sort output according to the number of commits per author")),
-               OPT_BOOLEAN('s', "summary", &log.summary,
-                           N_("Suppress commit descriptions, only provides commit count")),
-               OPT_BOOLEAN('e', "email", &log.email,
-                           N_("Show the email address of each author")),
+               OPT_BOOL('n', "numbered", &log.sort_by_number,
+                        N_("sort output according to the number of commits per author")),
+               OPT_BOOL('s', "summary", &log.summary,
+                        N_("Suppress commit descriptions, only provides commit count")),
+               OPT_BOOL('e', "email", &log.email,
+                        N_("Show the email address of each author")),
                { OPTION_CALLBACK, 'w', NULL, &log, N_("w[,i1[,i2]]"),
                        N_("Linewrap output"), PARSE_OPT_OPTARG, &parse_wrap_args },
                OPT_END(),
index 9788eb115beb2ab5663bd1d318ce411099589321..001f29ca1b9ef8bfe2a06cda4d98c704584812fe 100644 (file)
@@ -646,30 +646,30 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
        int dense = 1;
        const char *reflog_base = NULL;
        struct option builtin_show_branch_options[] = {
-               OPT_BOOLEAN('a', "all", &all_heads,
-                           N_("show remote-tracking and local branches")),
-               OPT_BOOLEAN('r', "remotes", &all_remotes,
-                           N_("show remote-tracking branches")),
+               OPT_BOOL('a', "all", &all_heads,
+                        N_("show remote-tracking and local branches")),
+               OPT_BOOL('r', "remotes", &all_remotes,
+                        N_("show remote-tracking branches")),
                OPT__COLOR(&showbranch_use_color,
                            N_("color '*!+-' corresponding to the branch")),
                { OPTION_INTEGER, 0, "more", &extra, N_("n"),
                            N_("show <n> more commits after the common ancestor"),
                            PARSE_OPT_OPTARG, NULL, (intptr_t)1 },
                OPT_SET_INT(0, "list", &extra, N_("synonym to more=-1"), -1),
-               OPT_BOOLEAN(0, "no-name", &no_name, N_("suppress naming strings")),
-               OPT_BOOLEAN(0, "current", &with_current_branch,
-                           N_("include the current branch")),
-               OPT_BOOLEAN(0, "sha1-name", &sha1_name,
-                           N_("name commits with their object names")),
-               OPT_BOOLEAN(0, "merge-base", &merge_base,
-                           N_("show possible merge bases")),
-               OPT_BOOLEAN(0, "independent", &independent,
+               OPT_BOOL(0, "no-name", &no_name, N_("suppress naming strings")),
+               OPT_BOOL(0, "current", &with_current_branch,
+                        N_("include the current branch")),
+               OPT_BOOL(0, "sha1-name", &sha1_name,
+                        N_("name commits with their object names")),
+               OPT_BOOL(0, "merge-base", &merge_base,
+                        N_("show possible merge bases")),
+               OPT_BOOL(0, "independent", &independent,
                            N_("show refs unreachable from any other ref")),
                OPT_SET_INT(0, "topo-order", &sort_order,
                            N_("show commits in topological order"),
                            REV_SORT_IN_GRAPH_ORDER),
-               OPT_BOOLEAN(0, "topics", &topics,
-                           N_("show only commits not on the first branch")),
+               OPT_BOOL(0, "topics", &topics,
+                        N_("show only commits not on the first branch")),
                OPT_SET_INT(0, "sparse", &dense,
                            N_("show merges reachable from only one tip"), 0),
                OPT_SET_INT(0, "date-order", &sort_order,
index 87806ad5b088f5c905757a4fab3c3499ec20a308..9f3f5e370bfb123df5c662bead122b29622fc1dd 100644 (file)
@@ -165,16 +165,15 @@ static int help_callback(const struct option *opt, const char *arg, int unset)
 }
 
 static const struct option show_ref_options[] = {
-       OPT_BOOLEAN(0, "tags", &tags_only, N_("only show tags (can be combined with heads)")),
-       OPT_BOOLEAN(0, "heads", &heads_only, N_("only show heads (can be combined with tags)")),
-       OPT_BOOLEAN(0, "verify", &verify, N_("stricter reference checking, "
+       OPT_BOOL(0, "tags", &tags_only, N_("only show tags (can be combined with heads)")),
+       OPT_BOOL(0, "heads", &heads_only, N_("only show heads (can be combined with tags)")),
+       OPT_BOOL(0, "verify", &verify, N_("stricter reference checking, "
                    "requires exact ref path")),
-       { OPTION_BOOLEAN, 'h', NULL, &show_head, NULL,
-         N_("show the HEAD reference, even if it would be filtered out"),
-         PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
-       OPT_BOOLEAN(0, "head", &show_head,
+       OPT_HIDDEN_BOOL('h', NULL, &show_head,
+                       N_("show the HEAD reference, even if it would be filtered out")),
+       OPT_BOOL(0, "head", &show_head,
          N_("show the HEAD reference, even if it would be filtered out")),
-       OPT_BOOLEAN('d', "dereference", &deref_tags,
+       OPT_BOOL('d', "dereference", &deref_tags,
                    N_("dereference tags into object IDs")),
        { OPTION_CALLBACK, 's', "hash", &abbrev, N_("n"),
          N_("only show SHA1 hash using <n> digits"),
index d8ae5aae2828c1e36a79f6182caaf6666ffc881b..b577af562a4a554f43c64256e112fcbc423edd3d 100644 (file)
@@ -450,12 +450,12 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
                OPT_CMDMODE('v', "verify", &cmdmode, N_("verify tags"), 'v'),
 
                OPT_GROUP(N_("Tag creation options")),
-               OPT_BOOLEAN('a', "annotate", &annotate,
+               OPT_BOOL('a', "annotate", &annotate,
                                        N_("annotated tag, needs a message")),
                OPT_CALLBACK('m', "message", &msg, N_("message"),
                             N_("tag message"), parse_msg_arg),
                OPT_FILENAME('F', "file", &msgfile, N_("read message from file")),
-               OPT_BOOLEAN('s', "sign", &opt.sign, N_("annotated and GPG-signed tag")),
+               OPT_BOOL('s', "sign", &opt.sign, N_("annotated and GPG-signed tag")),
                OPT_STRING(0, "cleanup", &cleanup_arg, N_("mode"),
                        N_("how to strip spaces and #comments from message")),
                OPT_STRING('u', "local-user", &keyid, N_("key id"),
index 51d26848598d7f18749f1f2859d7a74558d60b69..7484d36a65ba1f722f2dda33473bf509f30727c9 100644 (file)
@@ -16,8 +16,8 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
        int delete = 0, no_deref = 0, flags = 0;
        struct option options[] = {
                OPT_STRING( 'm', NULL, &msg, N_("reason"), N_("reason of the update")),
-               OPT_BOOLEAN('d', NULL, &delete, N_("delete the reference")),
-               OPT_BOOLEAN( 0 , "no-deref", &no_deref,
+               OPT_BOOL('d', NULL, &delete, N_("delete the reference")),
+               OPT_BOOL( 0 , "no-deref", &no_deref,
                                        N_("update <refname> not the one it points to")),
                OPT_END(),
        };
index f37fc88143f0cc0277b33d55ec92cc43034774cf..8736006ed73560ebb05abac2debb04d5117dc114 100644 (file)
@@ -22,9 +22,6 @@ enum parse_opt_type {
        OPTION_FILENAME
 };
 
-/* Deprecated synonym */
-#define OPTION_BOOLEAN OPTION_COUNTUP
-
 enum parse_opt_flags {
        PARSE_OPT_KEEP_DASHDASH = 1,
        PARSE_OPT_STOP_AT_NON_OPTION = 2,
@@ -129,6 +126,8 @@ struct option {
 #define OPT_SET_INT(s, l, v, h, i)  { OPTION_SET_INT, (s), (l), (v), NULL, \
                                      (h), PARSE_OPT_NOARG, NULL, (i) }
 #define OPT_BOOL(s, l, v, h)        OPT_SET_INT(s, l, v, h, 1)
+#define OPT_HIDDEN_BOOL(s, l, v, h) { OPTION_SET_INT, (s), (l), (v), NULL, \
+                                     (h), PARSE_OPT_NOARG | PARSE_OPT_HIDDEN, NULL, 1}
 #define OPT_SET_PTR(s, l, v, h, p)  { OPTION_SET_PTR, (s), (l), (v), NULL, \
                                      (h), PARSE_OPT_NOARG, NULL, (p) }
 #define OPT_CMDMODE(s, l, v, h, i) { OPTION_CMDMODE, (s), (l), (v), NULL, \