mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00: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 lock' [--reason <string>] <worktree>
|
||||||
'git worktree move' <worktree> <new-path>
|
'git worktree move' <worktree> <new-path>
|
||||||
'git worktree prune' [-n] [-v] [--expire <expire>]
|
'git worktree prune' [-n] [-v] [--expire <expire>]
|
||||||
'git worktree remove' [--force] <worktree>
|
'git worktree remove' [-f] <worktree>
|
||||||
'git worktree unlock' <worktree>
|
'git worktree unlock' <worktree>
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
|
|
@ -790,8 +790,9 @@ static int remove_worktree(int ac, const char **av, const char *prefix)
|
||||||
{
|
{
|
||||||
int force = 0;
|
int force = 0;
|
||||||
struct option options[] = {
|
struct option options[] = {
|
||||||
OPT_BOOL(0, "force", &force,
|
OPT__FORCE(&force,
|
||||||
N_("force removing even if the worktree is dirty")),
|
N_("force removing even if the worktree is dirty"),
|
||||||
|
PARSE_OPT_NOCOMPLETE),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
struct worktree **worktrees, *wt;
|
struct worktree **worktrees, *wt;
|
||||||
|
|
Loading…
Reference in a new issue