Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-07-19 16:37:39 +0300
committerJunio C Hamano <gitster@pobox.com>2023-07-20 08:02:53 +0300
commit3821eb6c3dedba1c57522a1254a916f5ad0d15dc (patch)
tree8b7e512474231c28e77df75fca02b246a44a115a /builtin/reset.c
parentfb7d80edcae482f4fa5d4be0227dc3054734e5f3 (diff)
reset: reject --no-(mixed|soft|hard|merge|keep) option
"git reset --no-mixed" behaved exactly like "git reset --mixed", which was nonsense. If there were only two kinds, e.g. "mixed" vs "separate", it might have made sense to make "git reset --no-mixed" behave identically to "git reset --separate" and vice-versa, but because we have many types of reset, let's just forbid "--no-mixed" and negated form of other types. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/reset.c')
-rw-r--r--builtin/reset.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/builtin/reset.c b/builtin/reset.c
index f99f32d580..ac4901e003 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -334,18 +334,25 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
OPT__QUIET(&quiet, N_("be quiet, only report errors")),
OPT_BOOL(0, "no-refresh", &no_refresh,
N_("skip refreshing the index after reset")),
- OPT_SET_INT(0, "mixed", &reset_type,
- N_("reset HEAD and index"), MIXED),
- OPT_SET_INT(0, "soft", &reset_type, N_("reset only HEAD"), SOFT),
- OPT_SET_INT(0, "hard", &reset_type,
- N_("reset HEAD, index and working tree"), HARD),
- OPT_SET_INT(0, "merge", &reset_type,
- N_("reset HEAD, index and working tree"), MERGE),
- OPT_SET_INT(0, "keep", &reset_type,
- N_("reset HEAD but keep local changes"), KEEP),
+ OPT_SET_INT_F(0, "mixed", &reset_type,
+ N_("reset HEAD and index"),
+ MIXED, PARSE_OPT_NONEG),
+ OPT_SET_INT_F(0, "soft", &reset_type,
+ N_("reset only HEAD"),
+ SOFT, PARSE_OPT_NONEG),
+ OPT_SET_INT_F(0, "hard", &reset_type,
+ N_("reset HEAD, index and working tree"),
+ HARD, PARSE_OPT_NONEG),
+ OPT_SET_INT_F(0, "merge", &reset_type,
+ N_("reset HEAD, index and working tree"),
+ MERGE, PARSE_OPT_NONEG),
+ OPT_SET_INT_F(0, "keep", &reset_type,
+ N_("reset HEAD but keep local changes"),
+ KEEP, PARSE_OPT_NONEG),
OPT_CALLBACK_F(0, "recurse-submodules", NULL,
- "reset", "control recursive updating of submodules",
- PARSE_OPT_OPTARG, option_parse_recurse_submodules_worktree_updater),
+ "reset", "control recursive updating of submodules",
+ PARSE_OPT_OPTARG,
+ option_parse_recurse_submodules_worktree_updater),
OPT_BOOL('p', "patch", &patch_mode, N_("select hunks interactively")),
OPT_BOOL('N', "intent-to-add", &intent_to_add,
N_("record only the fact that removed paths will be added later")),