aboutsummaryrefslogtreecommitdiffstats
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/am.c28
-rw-r--r--builtin/backfill.c4
-rw-r--r--builtin/clone.c13
-rw-r--r--builtin/column.c2
-rw-r--r--builtin/commit-tree.c12
-rw-r--r--builtin/commit.c62
-rw-r--r--builtin/config.c13
-rw-r--r--builtin/describe.c24
-rw-r--r--builtin/fetch.c10
-rw-r--r--builtin/fmt-merge-msg.c27
-rw-r--r--builtin/gc.c16
-rw-r--r--builtin/grep.c18
-rw-r--r--builtin/init-db.c13
-rw-r--r--builtin/ls-remote.c11
-rw-r--r--builtin/merge.c38
-rw-r--r--builtin/multi-pack-index.c2
-rw-r--r--builtin/pack-objects.c8
-rw-r--r--builtin/read-tree.c11
-rw-r--r--builtin/rebase.c25
-rw-r--r--builtin/repack.c14
-rw-r--r--builtin/revert.c12
-rw-r--r--builtin/show-branch.c13
-rw-r--r--builtin/tag.c24
-rw-r--r--builtin/update-index.c131
-rw-r--r--builtin/write-tree.c12
25 files changed, 392 insertions, 151 deletions
diff --git a/builtin/am.c b/builtin/am.c
index 3b61bd4c33..4afb519830 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -2400,11 +2400,16 @@ int cmd_am(int argc,
OPT_CMDMODE(0, "quit", &resume_mode,
N_("abort the patching operation but keep HEAD where it is"),
RESUME_QUIT),
- { OPTION_CALLBACK, 0, "show-current-patch", &resume_mode,
- "(diff|raw)",
- N_("show the patch being applied"),
- PARSE_OPT_CMDMODE | PARSE_OPT_OPTARG | PARSE_OPT_NONEG | PARSE_OPT_LITERAL_ARGHELP,
- parse_opt_show_current_patch, RESUME_SHOW_PATCH_RAW },
+ {
+ .type = OPTION_CALLBACK,
+ .long_name = "show-current-patch",
+ .value = &resume_mode,
+ .argh = "(diff|raw)",
+ .help = N_("show the patch being applied"),
+ .flags = PARSE_OPT_CMDMODE | PARSE_OPT_OPTARG | PARSE_OPT_NONEG | PARSE_OPT_LITERAL_ARGHELP,
+ .callback = parse_opt_show_current_patch,
+ .defval = RESUME_SHOW_PATCH_RAW,
+ },
OPT_CMDMODE(0, "retry", &resume_mode,
N_("try to apply current patch again"),
RESUME_APPLY),
@@ -2417,9 +2422,16 @@ int cmd_am(int argc,
OPT_BOOL(0, "ignore-date", &state.ignore_date,
N_("use current timestamp for author date")),
OPT_RERERE_AUTOUPDATE(&state.allow_rerere_autoupdate),
- { OPTION_STRING, 'S', "gpg-sign", &state.sign_commit, N_("key-id"),
- N_("GPG-sign commits"),
- PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
+ {
+ .type = OPTION_STRING,
+ .short_name = 'S',
+ .long_name = "gpg-sign",
+ .value = &state.sign_commit,
+ .argh = N_("key-id"),
+ .help = N_("GPG-sign commits"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = (intptr_t) "",
+ },
OPT_CALLBACK_F(0, "empty", &state.empty_type, "(stop|drop|keep)",
N_("how to handle empty patches"),
PARSE_OPT_NONEG, am_option_parse_empty),
diff --git a/builtin/backfill.c b/builtin/backfill.c
index aaa104bc91..fa82ad2f6f 100644
--- a/builtin/backfill.c
+++ b/builtin/backfill.c
@@ -123,8 +123,8 @@ int cmd_backfill(int argc, const char **argv, const char *prefix, struct reposit
.sparse = 0,
};
struct option options[] = {
- OPT_INTEGER(0, "min-batch-size", &ctx.min_batch_size,
- N_("Minimum number of objects to request at a time")),
+ OPT_UNSIGNED(0, "min-batch-size", &ctx.min_batch_size,
+ N_("Minimum number of objects to request at a time")),
OPT_BOOL(0, "sparse", &ctx.sparse,
N_("Restrict the missing objects to the current sparse-checkout")),
OPT_END(),
diff --git a/builtin/clone.c b/builtin/clone.c
index 6b1d11a3ed..b6f378c438 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -932,9 +932,16 @@ int cmd_clone(int argc,
N_("don't use local hardlinks, always copy")),
OPT_BOOL('s', "shared", &option_shared,
N_("setup as shared repository")),
- { OPTION_CALLBACK, 0, "recurse-submodules", &option_recurse_submodules,
- N_("pathspec"), N_("initialize submodules in the clone"),
- PARSE_OPT_OPTARG, recurse_submodules_cb, (intptr_t)"." },
+ {
+ .type = OPTION_CALLBACK,
+ .long_name = "recurse-submodules",
+ .value = &option_recurse_submodules,
+ .argh = N_("pathspec"),
+ .help = N_("initialize submodules in the clone"),
+ .flags = PARSE_OPT_OPTARG,
+ .callback = recurse_submodules_cb,
+ .defval = (intptr_t)".",
+ },
OPT_ALIAS(0, "recursive", "recurse-submodules"),
OPT_INTEGER('j', "jobs", &max_jobs,
N_("number of submodules cloned in parallel")),
diff --git a/builtin/column.c b/builtin/column.c
index 50314cc255..ce6443d5fa 100644
--- a/builtin/column.c
+++ b/builtin/column.c
@@ -31,7 +31,7 @@ int cmd_column(int argc,
struct option options[] = {
OPT_STRING(0, "command", &real_command, N_("name"), N_("lookup config vars")),
OPT_COLUMN(0, "mode", &colopts, N_("layout to use")),
- OPT_INTEGER(0, "raw-mode", &colopts, N_("layout to use")),
+ OPT_UNSIGNED(0, "raw-mode", &colopts, N_("layout to use")),
OPT_INTEGER(0, "width", &copts.width, N_("maximum width")),
OPT_STRING(0, "indent", &copts.indent, N_("string"), N_("padding space on left border")),
OPT_STRING(0, "nl", &copts.nl, N_("string"), N_("padding space on right border")),
diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c
index 6f9975e7a8..ad6b2c9320 100644
--- a/builtin/commit-tree.c
+++ b/builtin/commit-tree.c
@@ -111,8 +111,16 @@ int cmd_commit_tree(int argc,
OPT_CALLBACK_F('F', NULL, &buffer, N_("file"),
N_("read commit log message from file"), PARSE_OPT_NONEG,
parse_file_arg_callback),
- { OPTION_STRING, 'S', "gpg-sign", &sign_commit, N_("key-id"),
- N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
+ {
+ .type = OPTION_STRING,
+ .short_name = 'S',
+ .long_name = "gpg-sign",
+ .value = &sign_commit,
+ .argh = N_("key-id"),
+ .help = N_("GPG sign commit"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = (intptr_t) "",
+ },
OPT_END()
};
int ret;
diff --git a/builtin/commit.c b/builtin/commit.c
index 2f45968222..66bd91fd52 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1542,17 +1542,34 @@ struct repository *repo UNUSED)
STATUS_FORMAT_LONG),
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" },
- { OPTION_STRING, 0, "ignored", &ignored_arg,
- N_("mode"),
- N_("show ignored files, optional modes: traditional, matching, no. (Default: traditional)"),
- PARSE_OPT_OPTARG, NULL, (intptr_t)"traditional" },
- { 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" },
+ {
+ .type = OPTION_STRING,
+ .short_name = 'u',
+ .long_name = "untracked-files",
+ .value = &untracked_files_arg,
+ .argh = N_("mode"),
+ .help = N_("show untracked files, optional modes: all, normal, no. (Default: all)"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = (intptr_t)"all",
+ },
+ {
+ .type = OPTION_STRING,
+ .long_name = "ignored",
+ .value = &ignored_arg,
+ .argh = N_("mode"),
+ .help = N_("show ignored files, optional modes: traditional, matching, no. (Default: traditional)"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = (intptr_t)"traditional",
+ },
+ {
+ .type = OPTION_STRING,
+ .long_name = "ignore-submodules",
+ .value = &ignore_submodule_arg,
+ .argh = N_("when"),
+ .help = N_("ignore changes to submodules, optional when: all, dirty, untracked. (Default: all)"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = (intptr_t)"all",
+ },
OPT_COLUMN(0, "column", &s.colopts, N_("list untracked files in columns")),
OPT_BOOL(0, "no-renames", &no_renames, N_("do not detect renames")),
OPT_CALLBACK_F('M', "find-renames", &rename_score_arg,
@@ -1688,8 +1705,16 @@ int cmd_commit(int argc,
OPT_BOOL('e', "edit", &edit_flag, N_("force edit of commit")),
OPT_CLEANUP(&cleanup_arg),
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) "" },
+ {
+ .type = OPTION_STRING,
+ .short_name = 'S',
+ .long_name = "gpg-sign",
+ .value = &sign_commit,
+ .argh = N_("key-id"),
+ .help = N_("GPG sign commit"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = (intptr_t) "",
+ },
/* end commit message options */
OPT_GROUP(N_("Commit contents options")),
@@ -1714,7 +1739,16 @@ int cmd_commit(int argc,
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" },
+ {
+ .type = OPTION_STRING,
+ .short_name = 'u',
+ .long_name = "untracked-files",
+ .value = &untracked_files_arg,
+ .argh = N_("mode"),
+ .help = N_("show untracked files, optional modes: all, normal, no. (Default: all)"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = (intptr_t)"all",
+ },
OPT_PATHSPEC_FROM_FILE(&pathspec_from_file),
OPT_PATHSPEC_FILE_NUL(&pathspec_file_nul),
/* end commit contents options */
diff --git a/builtin/config.c b/builtin/config.c
index 53a90094e3..f70d635477 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -131,9 +131,16 @@ struct config_display_options {
#define TYPE_COLOR 6
#define TYPE_BOOL_OR_STR 7
-#define OPT_CALLBACK_VALUE(s, l, v, h, i) \
- { OPTION_CALLBACK, (s), (l), (v), NULL, (h), PARSE_OPT_NOARG | \
- PARSE_OPT_NONEG, option_parse_type, (i) }
+#define OPT_CALLBACK_VALUE(s, l, v, h, i) { \
+ .type = OPTION_CALLBACK, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .help = (h), \
+ .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG, \
+ .callback = option_parse_type, \
+ .defval = (i), \
+}
static int option_parse_type(const struct option *opt, const char *arg,
int unset)
diff --git a/builtin/describe.c b/builtin/describe.c
index 0f87fbceef..2d50883b72 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -601,12 +601,24 @@ int cmd_describe(int argc,
N_("do not consider tags matching <pattern>")),
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"},
- {OPTION_STRING, 0, "broken", &broken, N_("mark"),
- N_("append <mark> on broken working tree (default: \"-broken\")"),
- PARSE_OPT_OPTARG, NULL, (intptr_t) "-broken"},
+ {
+ .type = OPTION_STRING,
+ .long_name = "dirty",
+ .value = &dirty,
+ .argh = N_("mark"),
+ .help = N_("append <mark> on dirty working tree (default: \"-dirty\")"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = (intptr_t) "-dirty",
+ },
+ {
+ .type = OPTION_STRING,
+ .long_name = "broken",
+ .value = &broken,
+ .argh = N_("mark"),
+ .help = N_("append <mark> on broken working tree (default: \"-broken\")"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = (intptr_t) "-broken",
+ },
OPT_END(),
};
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 95589b4994..5279997c96 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -2352,8 +2352,14 @@ int cmd_fetch(int argc,
OPT_SET_INT_F(0, "refetch", &refetch,
N_("re-fetch without negotiating common commits"),
1, PARSE_OPT_NONEG),
- { OPTION_STRING, 0, "submodule-prefix", &submodule_prefix, N_("dir"),
- N_("prepend this to submodule path output"), PARSE_OPT_HIDDEN },
+ {
+ .type = OPTION_STRING,
+ .long_name = "submodule-prefix",
+ .value = &submodule_prefix,
+ .argh = N_("dir"),
+ .help = N_("prepend this to submodule path output"),
+ .flags = PARSE_OPT_HIDDEN,
+ },
OPT_CALLBACK_F(0, "recurse-submodules-default",
&recurse_submodules_default, N_("on-demand"),
N_("default for recursive fetching of submodules "
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 189cd1096a..3b6aac2cf7 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -20,13 +20,26 @@ int cmd_fmt_merge_msg(int argc,
char *into_name = NULL;
int shortlog_len = -1;
struct option options[] = {
- { OPTION_INTEGER, 0, "log", &shortlog_len, N_("n"),
- N_("populate log with at most <n> entries from shortlog"),
- PARSE_OPT_OPTARG, NULL, DEFAULT_MERGE_LOG_LEN },
- { OPTION_INTEGER, 0, "summary", &shortlog_len, N_("n"),
- N_("alias for --log (deprecated)"),
- PARSE_OPT_OPTARG | PARSE_OPT_HIDDEN, NULL,
- DEFAULT_MERGE_LOG_LEN },
+ {
+ .type = OPTION_INTEGER,
+ .long_name = "log",
+ .value = &shortlog_len,
+ .precision = sizeof(shortlog_len),
+ .argh = N_("n"),
+ .help = N_("populate log with at most <n> entries from shortlog"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = DEFAULT_MERGE_LOG_LEN,
+ },
+ {
+ .type = OPTION_INTEGER,
+ .long_name = "summary",
+ .value = &shortlog_len,
+ .precision = sizeof(shortlog_len),
+ .argh = N_("n"),
+ .help = N_("alias for --log (deprecated)"),
+ .flags = PARSE_OPT_OPTARG | PARSE_OPT_HIDDEN,
+ .defval = DEFAULT_MERGE_LOG_LEN,
+ },
OPT_STRING('m', "message", &message, N_("text"),
N_("use <text> as start of message")),
OPT_STRING(0, "into-name", &into_name, N_("name"),
diff --git a/builtin/gc.c b/builtin/gc.c
index b5ce1d3276..856dd50559 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -743,12 +743,18 @@ struct repository *repo UNUSED)
int ret;
struct option builtin_gc_options[] = {
OPT__QUIET(&quiet, N_("suppress progress reporting")),
- { OPTION_STRING, 0, "prune", &prune_expire_arg, N_("date"),
- N_("prune unreferenced objects"),
- PARSE_OPT_OPTARG, NULL, (intptr_t)prune_expire_arg },
+ {
+ .type = OPTION_STRING,
+ .long_name = "prune",
+ .value = &prune_expire_arg,
+ .argh = N_("date"),
+ .help = N_("prune unreferenced objects"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = (intptr_t)prune_expire_arg,
+ },
OPT_BOOL(0, "cruft", &cfg.cruft_packs, N_("pack unreferenced objects separately")),
- OPT_MAGNITUDE(0, "max-cruft-size", &cfg.max_cruft_size,
- N_("with --cruft, limit the size of new cruft packs")),
+ OPT_UNSIGNED(0, "max-cruft-size", &cfg.max_cruft_size,
+ N_("with --cruft, limit the size of new cruft packs")),
OPT_BOOL(0, "aggressive", &aggressive, N_("be more thorough (increased runtime)")),
OPT_BOOL_F(0, "auto", &opts.auto_flag, N_("enable auto-gc mode"),
PARSE_OPT_NOCOMPLETE),
diff --git a/builtin/grep.c b/builtin/grep.c
index bcfbe5be5b..3ce574a605 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -983,9 +983,9 @@ int cmd_grep(int argc,
OPT_CALLBACK('C', "context", &opt, N_("n"),
N_("show <n> context lines before and after matches"),
context_callback),
- OPT_INTEGER('B', "before-context", &opt.pre_context,
+ OPT_UNSIGNED('B', "before-context", &opt.pre_context,
N_("show <n> context lines before matches")),
- OPT_INTEGER('A', "after-context", &opt.post_context,
+ OPT_UNSIGNED('A', "after-context", &opt.post_context,
N_("show <n> context lines after matches")),
OPT_INTEGER(0, "threads", &num_threads,
N_("use <n> worker threads")),
@@ -1017,10 +1017,16 @@ int cmd_grep(int argc,
OPT_BOOL(0, "all-match", &opt.all_match,
N_("show only matches from files that match all patterns")),
OPT_GROUP(""),
- { OPTION_STRING, 'O', "open-files-in-pager", &show_in_pager,
- N_("pager"), N_("show matching files in the pager"),
- PARSE_OPT_OPTARG | PARSE_OPT_NOCOMPLETE,
- NULL, (intptr_t)default_pager },
+ {
+ .type = OPTION_STRING,
+ .short_name = 'O',
+ .long_name = "open-files-in-pager",
+ .value = &show_in_pager,
+ .argh = N_("pager"),
+ .help = N_("show matching files in the pager"),
+ .flags = PARSE_OPT_OPTARG | PARSE_OPT_NOCOMPLETE,
+ .defval = (intptr_t)default_pager,
+ },
OPT_BOOL_F(0, "ext-grep", &external_grep_allowed__ignored,
N_("allow calling of grep(1) (ignored by this build)"),
PARSE_OPT_NOCOMPLETE),
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 91c2563e34..bb853e69f5 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -92,10 +92,15 @@ int cmd_init_db(int argc,
N_("directory from which templates will be used")),
OPT_SET_INT(0, "bare", &is_bare_repository_cfg,
N_("create a bare repository"), 1),
- { OPTION_CALLBACK, 0, "shared", &init_shared_repository,
- N_("permissions"),
- N_("specify that the git repository is to be shared amongst several users"),
- PARSE_OPT_OPTARG | PARSE_OPT_NONEG, shared_callback, 0},
+ {
+ .type = OPTION_CALLBACK,
+ .long_name = "shared",
+ .value = &init_shared_repository,
+ .argh = N_("permissions"),
+ .help = N_("specify that the git repository is to be shared amongst several users"),
+ .flags = PARSE_OPT_OPTARG | PARSE_OPT_NONEG,
+ .callback = shared_callback
+ },
OPT_BIT('q', "quiet", &flags, N_("be quiet"), INIT_DB_QUIET),
OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"),
N_("separate git dir from working tree")),
diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c
index 42f34e1236..01a4d4daa1 100644
--- a/builtin/ls-remote.c
+++ b/builtin/ls-remote.c
@@ -67,9 +67,14 @@ int cmd_ls_remote(int argc,
OPT__QUIET(&quiet, N_("do not print remote URL")),
OPT_STRING(0, "upload-pack", &uploadpack, N_("exec"),
N_("path of git-upload-pack on the remote host")),
- { OPTION_STRING, 0, "exec", &uploadpack, N_("exec"),
- N_("path of git-upload-pack on the remote host"),
- PARSE_OPT_HIDDEN },
+ {
+ .type = OPTION_STRING,
+ .long_name = "exec",
+ .value = &uploadpack,
+ .argh = N_("exec"),
+ .help = N_("path of git-upload-pack on the remote host"),
+ .flags = PARSE_OPT_HIDDEN,
+ },
OPT_BIT('t', "tags", &flags, N_("limit to tags"), REF_TAGS),
OPT_BIT('b', "branches", &flags, N_("limit to branches"), REF_BRANCHES),
OPT_BIT_F('h', "heads", &flags,
diff --git a/builtin/merge.c b/builtin/merge.c
index 9efd585842..ce90e52fe4 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -249,9 +249,16 @@ static struct option builtin_merge_options[] = {
OPT_BOOL(0, "stat", &show_diffstat,
N_("show a diffstat at the end of the merge")),
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 },
+ {
+ .type = OPTION_INTEGER,
+ .long_name = "log",
+ .value = &shortlog_len,
+ .precision = sizeof(shortlog_len),
+ .argh = N_("n"),
+ .help = N_("add (at most <n>) entries from shortlog to merge commit message"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = DEFAULT_MERGE_LOG_LEN,
+ },
OPT_BOOL(0, "squash", &squash,
N_("create a single commit instead of doing a merge")),
OPT_BOOL(0, "commit", &option_commit,
@@ -273,9 +280,16 @@ static struct option builtin_merge_options[] = {
OPT_CALLBACK('m', "message", &merge_msg, N_("message"),
N_("merge commit message (for a non-fast-forward merge)"),
option_parse_message),
- { OPTION_LOWLEVEL_CALLBACK, 'F', "file", &merge_msg, N_("path"),
- N_("read message from file"), PARSE_OPT_NONEG,
- NULL, 0, option_read_message },
+ {
+ .type = OPTION_LOWLEVEL_CALLBACK,
+ .short_name = 'F',
+ .long_name = "file",
+ .value = &merge_msg,
+ .argh = N_("path"),
+ .help = N_("read message from file"),
+ .flags = PARSE_OPT_NONEG,
+ .ll_callback = option_read_message,
+ },
OPT_STRING(0, "into-name", &into_name, N_("name"),
N_("use <name> instead of the real target")),
OPT__VERBOSITY(&verbosity),
@@ -288,8 +302,16 @@ static struct option builtin_merge_options[] = {
OPT_BOOL(0, "allow-unrelated-histories", &allow_unrelated_histories,
N_("allow merging unrelated histories")),
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) "" },
+ {
+ .type = OPTION_STRING,
+ .short_name = 'S',
+ .long_name = "gpg-sign",
+ .value = &sign_commit,
+ .argh = N_("key-id"),
+ .help = N_("GPG sign commit"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = (intptr_t) "",
+ },
OPT_AUTOSTASH(&autostash),
OPT_BOOL(0, "overwrite-ignore", &overwrite_ignore, N_("update ignored files (default)")),
OPT_BOOL(0, "signoff", &signoff, N_("add a Signed-off-by trailer")),
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
index d98410ca6c..69a9750732 100644
--- a/builtin/multi-pack-index.c
+++ b/builtin/multi-pack-index.c
@@ -245,7 +245,7 @@ static int cmd_multi_pack_index_repack(int argc, const char **argv,
{
struct option *options;
static struct option builtin_multi_pack_index_repack_options[] = {
- OPT_MAGNITUDE(0, "batch-size", &opts.batch_size,
+ OPT_UNSIGNED(0, "batch-size", &opts.batch_size,
N_("during repack, collect pack-files of smaller size into a batch that is larger than this size")),
OPT_BIT(0, "progress", &opts.flags,
N_("force progress reporting"), MIDX_PROGRESS),
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 8174c60c70..72ebe13fe0 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -4488,16 +4488,16 @@ int cmd_pack_objects(int argc,
OPT_CALLBACK_F(0, "index-version", &pack_idx_opts, N_("<version>[,<offset>]"),
N_("write the pack index file in the specified idx format version"),
PARSE_OPT_NONEG, option_parse_index_version),
- OPT_MAGNITUDE(0, "max-pack-size", &pack_size_limit,
- N_("maximum size of each output pack file")),
+ OPT_UNSIGNED(0, "max-pack-size", &pack_size_limit,
+ N_("maximum size of each output pack file")),
OPT_BOOL(0, "local", &local,
N_("ignore borrowed objects from alternate object store")),
OPT_BOOL(0, "incremental", &incremental,
N_("ignore packed objects")),
OPT_INTEGER(0, "window", &window,
N_("limit pack window by objects")),
- OPT_MAGNITUDE(0, "window-memory", &window_memory_limit,
- N_("limit pack window by memory in addition to object limit")),
+ OPT_UNSIGNED(0, "window-memory", &window_memory_limit,
+ N_("limit pack window by memory in addition to object limit")),
OPT_INTEGER(0, "depth", &depth,
N_("maximum length of delta chain allowed in the resulting pack")),
OPT_BOOL(0, "reuse-delta", &reuse_delta,
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index d2a807a828..a8f352f7cd 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -135,9 +135,14 @@ int cmd_read_tree(int argc,
N_("3-way merge in presence of adds and removes")),
OPT_BOOL(0, "reset", &opts.reset,
N_("same as -m, but discard unmerged entries")),
- { OPTION_STRING, 0, "prefix", &opts.prefix, N_("<subdirectory>/"),
- N_("read the tree into the index under <subdirectory>/"),
- PARSE_OPT_NONEG },
+ {
+ .type = OPTION_STRING,
+ .long_name = "prefix",
+ .value = &opts.prefix,
+ .argh = N_("<subdirectory>/"),
+ .help = N_("read the tree into the index under <subdirectory>/"),
+ .flags = PARSE_OPT_NONEG,
+ },
OPT_BOOL('u', NULL, &opts.update,
N_("update working tree with merge result")),
OPT_CALLBACK_F(0, "exclude-per-directory", &opts,
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 36e336009c..2e8c4ee678 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1123,9 +1123,15 @@ int cmd_rebase(int argc,
OPT_BIT('v', "verbose", &options.flags,
N_("display a diffstat of what changed upstream"),
REBASE_NO_QUIET | REBASE_VERBOSE | REBASE_DIFFSTAT),
- {OPTION_NEGBIT, 'n', "no-stat", &options.flags, NULL,
- N_("do not show diffstat of what changed upstream"),
- PARSE_OPT_NOARG, NULL, REBASE_DIFFSTAT },
+ {
+ .type = OPTION_NEGBIT,
+ .short_name = 'n',
+ .long_name = "no-stat",
+ .value = &options.flags,
+ .help = N_("do not show diffstat of what changed upstream"),
+ .flags = PARSE_OPT_NOARG,
+ .defval = REBASE_DIFFSTAT,
+ },
OPT_BOOL(0, "signoff", &options.signoff,
N_("add a Signed-off-by trailer to each commit")),
OPT_BOOL(0, "committer-date-is-author-date",
@@ -1191,9 +1197,16 @@ int cmd_rebase(int argc,
OPT_BOOL(0, "update-refs", &options.update_refs,
N_("update branches that point to commits "
"that are being rebased")),
- { OPTION_STRING, 'S', "gpg-sign", &gpg_sign, N_("key-id"),
- N_("GPG-sign commits"),
- PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
+ {
+ .type = OPTION_STRING,
+ .short_name = 'S',
+ .long_name = "gpg-sign",
+ .value = &gpg_sign,
+ .argh = N_("key-id"),
+ .help = N_("GPG-sign commits"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = (intptr_t) "",
+ },
OPT_AUTOSTASH(&options.autostash),
OPT_STRING_LIST('x', "exec", &options.exec, N_("exec"),
N_("add exec lines after each commit of the "
diff --git a/builtin/repack.c b/builtin/repack.c
index 1fd2874324..59214dbdfd 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -1171,11 +1171,11 @@ int cmd_repack(int argc,
PACK_CRUFT),
OPT_STRING(0, "cruft-expiration", &cruft_expiration, N_("approxidate"),
N_("with --cruft, expire objects older than this")),
- OPT_MAGNITUDE(0, "combine-cruft-below-size",
- &combine_cruft_below_size,
- N_("with --cruft, only repack cruft packs smaller than this")),
- OPT_MAGNITUDE(0, "max-cruft-size", &cruft_po_args.max_pack_size,
- N_("with --cruft, limit the size of new cruft packs")),
+ OPT_UNSIGNED(0, "combine-cruft-below-size",
+ &combine_cruft_below_size,
+ N_("with --cruft, only repack cruft packs smaller than this")),
+ OPT_UNSIGNED(0, "max-cruft-size", &cruft_po_args.max_pack_size,
+ N_("with --cruft, limit the size of new cruft packs")),
OPT_BOOL('d', NULL, &delete_redundant,
N_("remove redundant packs, and run git-prune-packed")),
OPT_BOOL('f', NULL, &po_args.no_reuse_delta,
@@ -1205,8 +1205,8 @@ int cmd_repack(int argc,
N_("limits the maximum delta depth")),
OPT_STRING(0, "threads", &opt_threads, N_("n"),
N_("limits the maximum number of threads")),
- OPT_MAGNITUDE(0, "max-pack-size", &po_args.max_pack_size,
- N_("maximum size of each packfile")),
+ OPT_UNSIGNED(0, "max-pack-size", &po_args.max_pack_size,
+ N_("maximum size of each packfile")),
OPT_PARSE_LIST_OBJECTS_FILTER(&po_args.filter_options),
OPT_BOOL(0, "pack-kept-objects", &pack_kept_objects,
N_("repack objects in packs marked with .keep")),
diff --git a/builtin/revert.c b/builtin/revert.c
index 2654f769a8..e07c2217fe 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -132,8 +132,16 @@ static int run_sequencer(int argc, const char **argv, const char *prefix,
OPT_STRING(0, "strategy", &strategy, N_("strategy"), N_("merge strategy")),
OPT_STRVEC('X', "strategy-option", &opts->xopts, N_("option"),
N_("option for merge strategy")),
- { OPTION_STRING, 'S', "gpg-sign", &gpg_sign, N_("key-id"),
- N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
+ {
+ .type = OPTION_STRING,
+ .short_name = 'S',
+ .long_name = "gpg-sign",
+ .value = &gpg_sign,
+ .argh = N_("key-id"),
+ .help = N_("GPG sign commit"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = (intptr_t) "",
+ },
OPT_END()
};
struct option *options = base_options;
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index fce6b404e9..b549d8c3f5 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -667,9 +667,16 @@ int cmd_show_branch(int ac,
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 },
+ {
+ .type = OPTION_INTEGER,
+ .long_name = "more",
+ .value = &extra,
+ .precision = sizeof(extra),
+ .argh = N_("n"),
+ .help = N_("show <n> more commits after the common ancestor"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = 1,
+ },
OPT_SET_INT(0, "list", &extra, N_("synonym to more=-1"), -1),
OPT_BOOL(0, "no-name", &no_name, N_("suppress naming strings")),
OPT_BOOL(0, "current", &with_current_branch,
diff --git a/builtin/tag.c b/builtin/tag.c
index e6b372cebf..4742b27d16 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -480,9 +480,16 @@ int cmd_tag(int argc,
int edit_flag = 0;
struct option options[] = {
OPT_CMDMODE('l', "list", &cmdmode, N_("list tag names"), 'l'),
- { OPTION_INTEGER, 'n', NULL, &filter.lines, N_("n"),
- N_("print <n> lines of each tag message"),
- PARSE_OPT_OPTARG, NULL, 1 },
+ {
+ .type = OPTION_INTEGER,
+ .short_name = 'n',
+ .value = &filter.lines,
+ .precision = sizeof(filter.lines),
+ .argh = N_("n"),
+ .help = N_("print <n> lines of each tag message"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = 1,
+ },
OPT_CMDMODE('d', "delete", &cmdmode, N_("delete tags"), 'd'),
OPT_CMDMODE('v', "verify", &cmdmode, N_("verify tags"), 'v'),
@@ -514,9 +521,14 @@ int cmd_tag(int argc,
N_("do not output a newline after empty formatted refs")),
OPT_REF_SORT(&sorting_options),
{
- OPTION_CALLBACK, 0, "points-at", &filter.points_at, N_("object"),
- N_("print only tags of the object"), PARSE_OPT_LASTARG_DEFAULT,
- parse_opt_object_name, (intptr_t) "HEAD"
+ .type = OPTION_CALLBACK,
+ .long_name = "points-at",
+ .value = &filter.points_at,
+ .argh = N_("object"),
+ .help = N_("print only tags of the object"),
+ .flags = PARSE_OPT_LASTARG_DEFAULT,
+ .callback = parse_opt_object_name,
+ .defval = (intptr_t) "HEAD",
},
OPT_STRING( 0 , "format", &format.format, N_("format"),
N_("format to use for the output")),
diff --git a/builtin/update-index.c b/builtin/update-index.c
index f0cf964294..538b619ba4 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -964,29 +964,51 @@ int cmd_update_index(int argc,
N_("like --refresh, but ignore assume-unchanged setting"),
PARSE_OPT_NOARG | PARSE_OPT_NONEG,
really_refresh_callback),
- {OPTION_LOWLEVEL_CALLBACK, 0, "cacheinfo", NULL,
- N_("<mode>,<object>,<path>"),
- N_("add the specified entry to the index"),
- PARSE_OPT_NOARG | /* disallow --cacheinfo=<mode> form */
- PARSE_OPT_NONEG | PARSE_OPT_LITERAL_ARGHELP,
- NULL, 0,
- cacheinfo_callback},
+ {
+ .type = OPTION_LOWLEVEL_CALLBACK,
+ .long_name = "cacheinfo",
+ .argh = N_("<mode>,<object>,<path>"),
+ .help = N_("add the specified entry to the index"),
+ .flags = PARSE_OPT_NOARG | /* disallow --cacheinfo=<mode> form */
+ PARSE_OPT_NONEG | PARSE_OPT_LITERAL_ARGHELP,
+ .ll_callback = cacheinfo_callback,
+ },
OPT_CALLBACK_F(0, "chmod", &set_executable_bit, "(+|-)x",
N_("override the executable bit of the listed files"),
PARSE_OPT_NONEG,
chmod_callback),
- {OPTION_SET_INT, 0, "assume-unchanged", &mark_valid_only, NULL,
- N_("mark files as \"not changing\""),
- PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, MARK_FLAG},
- {OPTION_SET_INT, 0, "no-assume-unchanged", &mark_valid_only, NULL,
- N_("clear assumed-unchanged bit"),
- PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, UNMARK_FLAG},
- {OPTION_SET_INT, 0, "skip-worktree", &mark_skip_worktree_only, NULL,
- N_("mark files as \"index-only\""),
- PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, MARK_FLAG},
- {OPTION_SET_INT, 0, "no-skip-worktree", &mark_skip_worktree_only, NULL,
- N_("clear skip-worktree bit"),
- PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, UNMARK_FLAG},
+ {
+ .type = OPTION_SET_INT,
+ .long_name = "assume-unchanged",
+ .value = &mark_valid_only,
+ .help = N_("mark files as \"not changing\""),
+ .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG,
+ .defval = MARK_FLAG,
+ },
+ {
+ .type = OPTION_SET_INT,
+ .long_name = "no-assume-unchanged",
+ .value = &mark_valid_only,
+ .help = N_("clear assumed-unchanged bit"),
+ .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG,
+ .defval = UNMARK_FLAG,
+ },
+ {
+ .type = OPTION_SET_INT,
+ .long_name = "skip-worktree",
+ .value = &mark_skip_worktree_only,
+ .help = N_("mark files as \"index-only\""),
+ .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG,
+ .defval = MARK_FLAG,
+ },
+ {
+ .type = OPTION_SET_INT,
+ .long_name = "no-skip-worktree",
+ .value = &mark_skip_worktree_only,
+ .help = N_("clear skip-worktree bit"),
+ .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG,
+ .defval = UNMARK_FLAG,
+ },
OPT_BOOL(0, "ignore-skip-worktree-entries", &ignore_skip_worktree_entries,
N_("do not touch index-only entries")),
OPT_SET_INT(0, "info-only", &info_only,
@@ -995,22 +1017,39 @@ int cmd_update_index(int argc,
N_("remove named paths even if present in worktree"), 1),
OPT_BOOL('z', NULL, &nul_term_line,
N_("with --stdin: input lines are terminated by null bytes")),
- {OPTION_LOWLEVEL_CALLBACK, 0, "stdin", &read_from_stdin, NULL,
- N_("read list of paths to be updated from standard input"),
- PARSE_OPT_NONEG | PARSE_OPT_NOARG,
- NULL, 0, stdin_callback},
- {OPTION_LOWLEVEL_CALLBACK, 0, "index-info", &nul_term_line, NULL,
- N_("add entries from standard input to the index"),
- PARSE_OPT_NONEG | PARSE_OPT_NOARG,
- NULL, 0, stdin_cacheinfo_callback},
- {OPTION_LOWLEVEL_CALLBACK, 0, "unresolve", &has_errors, NULL,
- N_("repopulate stages #2 and #3 for the listed paths"),
- PARSE_OPT_NONEG | PARSE_OPT_NOARG,
- NULL, 0, unresolve_callback},
- {OPTION_LOWLEVEL_CALLBACK, 'g', "again", &has_errors, NULL,
- N_("only update entries that differ from HEAD"),
- PARSE_OPT_NONEG | PARSE_OPT_NOARG,
- NULL, 0, reupdate_callback},
+ {
+ .type = OPTION_LOWLEVEL_CALLBACK,
+ .long_name = "stdin",
+ .value = &read_from_stdin,
+ .help = N_("read list of paths to be updated from standard input"),
+ .flags = PARSE_OPT_NONEG | PARSE_OPT_NOARG,
+ .ll_callback = stdin_callback,
+ },
+ {
+ .type = OPTION_LOWLEVEL_CALLBACK,
+ .long_name = "index-info",
+ .value = &nul_term_line,
+ .help = N_("add entries from standard input to the index"),
+ .flags = PARSE_OPT_NONEG | PARSE_OPT_NOARG,
+ .ll_callback = stdin_cacheinfo_callback,
+ },
+ {
+ .type = OPTION_LOWLEVEL_CALLBACK,
+ .long_name = "unresolve",
+ .value = &has_errors,
+ .help = N_("repopulate stages #2 and #3 for the listed paths"),
+ .flags = PARSE_OPT_NONEG | PARSE_OPT_NOARG,
+ .ll_callback = unresolve_callback,
+ },
+ {
+ .type = OPTION_LOWLEVEL_CALLBACK,
+ .short_name = 'g',
+ .long_name = "again",
+ .value = &has_errors,
+ .help = N_("only update entries that differ from HEAD"),
+ .flags = PARSE_OPT_NONEG | PARSE_OPT_NOARG,
+ .ll_callback = reupdate_callback,
+ },
OPT_BIT(0, "ignore-missing", &refresh_args.flags,
N_("ignore files missing from worktree"),
REFRESH_IGNORE_MISSING),
@@ -1036,12 +1075,22 @@ int cmd_update_index(int argc,
N_("write out the index even if is not flagged as changed"), 1),
OPT_BOOL(0, "fsmonitor", &fsmonitor,
N_("enable or disable file system monitor")),
- {OPTION_SET_INT, 0, "fsmonitor-valid", &mark_fsmonitor_only, NULL,
- N_("mark files as fsmonitor valid"),
- PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, MARK_FLAG},
- {OPTION_SET_INT, 0, "no-fsmonitor-valid", &mark_fsmonitor_only, NULL,
- N_("clear fsmonitor valid bit"),
- PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, UNMARK_FLAG},
+ {
+ .type = OPTION_SET_INT,
+ .long_name = "fsmonitor-valid",
+ .value = &mark_fsmonitor_only,
+ .help = N_("mark files as fsmonitor valid"),
+ .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG,
+ .defval = MARK_FLAG,
+ },
+ {
+ .type = OPTION_SET_INT,
+ .long_name = "no-fsmonitor-valid",
+ .value = &mark_fsmonitor_only,
+ .help = N_("clear fsmonitor valid bit"),
+ .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG,
+ .defval = UNMARK_FLAG,
+ },
OPT_END()
};
diff --git a/builtin/write-tree.c b/builtin/write-tree.c
index 43f233e69b..5a8dc377ec 100644
--- a/builtin/write-tree.c
+++ b/builtin/write-tree.c
@@ -31,10 +31,14 @@ int cmd_write_tree(int argc,
WRITE_TREE_MISSING_OK),
OPT_STRING(0, "prefix", &tree_prefix, N_("<prefix>/"),
N_("write tree object for a subdirectory <prefix>")),
- { OPTION_BIT, 0, "ignore-cache-tree", &flags, NULL,
- N_("only useful for debugging"),
- PARSE_OPT_HIDDEN | PARSE_OPT_NOARG, NULL,
- WRITE_TREE_IGNORE_CACHE_TREE },
+ {
+ .type = OPTION_BIT,
+ .long_name = "ignore-cache-tree",
+ .value = &flags,
+ .help = N_("only useful for debugging"),
+ .flags = PARSE_OPT_HIDDEN | PARSE_OPT_NOARG,
+ .defval = WRITE_TREE_IGNORE_CACHE_TREE,
+ },
OPT_END()
};