Skip to content

Commit 300c0a2

Browse files
committed
builtin/add.c: simplify boolean variables
Do not to explicitly initialize static variables to 0 and instead let BSS take care of it. Also use OPT_BOOL() to let the command line arguments set these variables to 0 or 1, instead of the deprecated OPT_BOOLEAN() aka OPT_COUNTUP(). Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5cae935 commit 300c0a2

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

builtin/add.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -270,23 +270,23 @@ static struct lock_file lock_file;
270270
static const char ignore_error[] =
271271
N_("The following paths are ignored by one of your .gitignore files:\n");
272272

273-
static int verbose = 0, show_only = 0, ignored_too = 0, refresh_only = 0;
274-
static int ignore_add_errors, addremove, intent_to_add, ignore_missing = 0;
273+
static int verbose, show_only, ignored_too, refresh_only;
274+
static int ignore_add_errors, addremove, intent_to_add, ignore_missing;
275275

276276
static struct option builtin_add_options[] = {
277277
OPT__DRY_RUN(&show_only, N_("dry run")),
278278
OPT__VERBOSE(&verbose, N_("be verbose")),
279279
OPT_GROUP(""),
280-
OPT_BOOLEAN('i', "interactive", &add_interactive, N_("interactive picking")),
281-
OPT_BOOLEAN('p', "patch", &patch_interactive, N_("select hunks interactively")),
282-
OPT_BOOLEAN('e', "edit", &edit_interactive, N_("edit current diff and apply")),
280+
OPT_BOOL('i', "interactive", &add_interactive, N_("interactive picking")),
281+
OPT_BOOL('p', "patch", &patch_interactive, N_("select hunks interactively")),
282+
OPT_BOOL('e', "edit", &edit_interactive, N_("edit current diff and apply")),
283283
OPT__FORCE(&ignored_too, N_("allow adding otherwise ignored files")),
284-
OPT_BOOLEAN('u', "update", &take_worktree_changes, N_("update tracked files")),
285-
OPT_BOOLEAN('N', "intent-to-add", &intent_to_add, N_("record only the fact that the path will be added later")),
286-
OPT_BOOLEAN('A', "all", &addremove, N_("add changes from all tracked and untracked files")),
287-
OPT_BOOLEAN( 0 , "refresh", &refresh_only, N_("don't add, only refresh the index")),
288-
OPT_BOOLEAN( 0 , "ignore-errors", &ignore_add_errors, N_("just skip files which cannot be added because of errors")),
289-
OPT_BOOLEAN( 0 , "ignore-missing", &ignore_missing, N_("check if - even missing - files are ignored in dry run")),
284+
OPT_BOOL('u', "update", &take_worktree_changes, N_("update tracked files")),
285+
OPT_BOOL('N', "intent-to-add", &intent_to_add, N_("record only the fact that the path will be added later")),
286+
OPT_BOOL('A', "all", &addremove, N_("add changes from all tracked and untracked files")),
287+
OPT_BOOL( 0 , "refresh", &refresh_only, N_("don't add, only refresh the index")),
288+
OPT_BOOL( 0 , "ignore-errors", &ignore_add_errors, N_("just skip files which cannot be added because of errors")),
289+
OPT_BOOL( 0 , "ignore-missing", &ignore_missing, N_("check if - even missing - files are ignored in dry run")),
290290
OPT_END(),
291291
};
292292

0 commit comments

Comments
 (0)