summaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/commit.c')
-rw-r--r--builtin/commit.c64
1 files changed, 49 insertions, 15 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 2f45968222..fba0dded64 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1022,7 +1022,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
for (i = 0; i < the_repository->index->cache_nr; i++)
if (ce_intent_to_add(the_repository->index->cache[i]))
ita_nr++;
- committable = the_repository->index->cache_nr - ita_nr > 0;
+ committable = the_repository->index->cache_nr > ita_nr;
} else {
/*
* Unless the user did explicitly request a submodule
@@ -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 */