mirror of
https://github.com/git/git.git
synced 2024-11-25 02:44:48 +08:00
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>
This commit is contained in:
parent
468165c1d8
commit
d228eea514
@ -14,7 +14,7 @@ SYNOPSIS
|
||||
'git worktree lock' [--reason <string>] <worktree>
|
||||
'git worktree move' <worktree> <new-path>
|
||||
'git worktree prune' [-n] [-v] [--expire <expire>]
|
||||
'git worktree remove' [--force] <worktree>
|
||||
'git worktree remove' [-f] <worktree>
|
||||
'git worktree unlock' <worktree>
|
||||
|
||||
DESCRIPTION
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user