summaryrefslogtreecommitdiff
path: root/builtin/worktree.c
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2015-07-17 19:00:08 -0400
committerJunio C Hamano <gitster@pobox.com>2015-07-20 11:29:24 -0700
commitab0b2c53ed853e34def18e7b84acd7da7e2ddd49 (patch)
tree6c89e86f3f5ec319aa1c4b0c4cdee378dc867fb4 /builtin/worktree.c
parent5dd6e234a75bb96e159c4e7d30f6acb28c3283a0 (diff)
downloadgit-ab0b2c53ed853e34def18e7b84acd7da7e2ddd49.tar.gz
worktree: make --detach mutually exclusive with -b/-B
Be consistent with git-checkout which disallows this (not particularly meaningful) combination. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/worktree.c')
-rw-r--r--builtin/worktree.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 7d70eb682c..813e016130 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);