From d228eea5146540b09376f90e2b805553cdc78590 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Tue, 17 Apr 2018 11:19:39 -0700 Subject: worktree: accept -f as short for --force for removal Many commands support a "--force" option, frequently abbreviated as "-f", however, "git worktree remove"'s hand-rolled OPT_BOOL forgets to recognize the short form, despite git-worktree.txt documenting "-f" as supported. Replace OPT_BOOL with OPT__FORCE, which provides "-f" for free, and makes 'remove' consistent with 'add' option parsing (which also specifies the PARSE_OPT_NOCOMPLETE flag). Helped-by: Eric Sunshine Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt index e7eb24a..99b713c 100644 --- a/Documentation/git-worktree.txt +++ b/Documentation/git-worktree.txt @@ -14,7 +14,7 @@ SYNOPSIS 'git worktree lock' [--reason ] 'git worktree move' 'git worktree prune' [-n] [-v] [--expire ] -'git worktree remove' [--force] +'git worktree remove' [-f] 'git worktree unlock' DESCRIPTION diff --git a/builtin/worktree.c b/builtin/worktree.c index 670555d..dba460f 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -790,8 +790,9 @@ static int remove_worktree(int ac, const char **av, const char *prefix) { int force = 0; struct option options[] = { - OPT_BOOL(0, "force", &force, - N_("force removing even if the worktree is dirty")), + OPT__FORCE(&force, + N_("force removing even if the worktree is dirty"), + PARSE_OPT_NOCOMPLETE), OPT_END() }; struct worktree **worktrees, *wt; -- cgit v0.10.2-6-g49f6