From: Eric Sunshine Date: Sat, 11 Jul 2015 00:05:39 GMT Subject: [PATCH 09/16] worktree: make --detach mutually exclusive with -b/-B Message-ID: <1436573146-3893-10-git-send-email-sunshine@sunshineco.com> In-Reply-To: <1436573146-3893-1-git-send-email-sunshine@sunshineco.com> Be consistent with git-checkout which disallows this (not particularly meaningful) combination. Signed-off-by: Eric Sunshine --- 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.rc1.201.ga12d9f8