summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2018-04-17 18:19:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-04-18 00:19:05 (GMT)
commitd228eea5146540b09376f90e2b805553cdc78590 (patch)
tree2d2f023ded0e655b1be1361eca0809af864abd93 /builtin
parent468165c1d8a442994a825f3684528361727cd8c0 (diff)
downloadgit-d228eea5146540b09376f90e2b805553cdc78590.zip
git-d228eea5146540b09376f90e2b805553cdc78590.tar.gz
git-d228eea5146540b09376f90e2b805553cdc78590.tar.bz2
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 <sunshine@sunshineco.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/worktree.c5
1 files changed, 3 insertions, 2 deletions
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;