[PATCH v2 12/20] worktree: make --detach mutually exclusive with -b/-B
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jul 16, 2015, 08:20 UTC
- Message-ID
- <1437034825-32054-13-git-send-email-sunshine@sunshineco.com>
- In-Reply-To
- <1437034825-32054-1-git-send-email-sunshine@sunshineco.com>
Be consistent with git-checkout which disallows this (not particularly meaningful) combination.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> ---
No changes since v1.
builtin/worktree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/worktree.c b/builtin/worktree.c index 253382a..cd06bf5 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -296,8 +296,8 @@ static int add(int ac, const char **av, const char *prefix) memset(&opts, 0, sizeof(opts)); ac = parse_options(ac, av, prefix, options, worktree_usage, 0); - if (opts.new_branch && new_branch_force) - die(_("-b and -B are mutually exclusive")); + if (!!opts.detach + !!opts.new_branch + !!new_branch_force > 1) + die(_("-b, -B, and --detach are mutually exclusive")); if (ac < 1 || ac > 2) usage_with_options(worktree_usage, options);
-- 2.5.0.rc2.378.g0af52e8