Johannes Schindelin wrote: > diff --git a/builtin-read-tree.c b/builtin-read-tree.c > index 9c2d634..d649c56 100644 > --- a/builtin-read-tree.c > +++ b/builtin-read-tree.c > @@ -113,14 +113,14 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) > argc = parse_options(argc, argv, unused_prefix, read_tree_options, > read_tree_usage, 0); > > - if (read_cache_unmerged() && (opts.prefix || opts.merge)) > - die("You need to resolve your current index first"); > - > prefix_set = opts.prefix ? 1 : 0; > if (1 < opts.merge + opts.reset + prefix_set) > die("Which one? -m, --reset, or --prefix?"); > stage = opts.merge = (opts.reset || opts.merge || prefix_set); > > + if (opts.merge && (read_cache_unmerged() && !prefix_set && !opts.reset)) > This looks more compact but I think the !prefix_set check is wrong. Yes, we want to do read_cache_unmerged() if we're doing some sort of merging operation. But we want to die() when either -m or --prefix is used. Therefore, die() if we're not doing a --reset. So we might as well just check that case and nothing else. The original patch from Alexandre is correct, but if you want to avoid extra nesting I suppose you could do something like the patch below. Thanks. --- diff --git a/builtin-read-tree.c b/builtin-read-tree.c index 9c2d634..c6d5b49 100644 --- a/builtin-read-tree.c +++ b/builtin-read-tree.c @@ -113,14 +113,14 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) argc = parse_options(argc, argv, unused_prefix, read_tree_options, read_tree_usage, 0); - if (read_cache_unmerged() && (opts.prefix || opts.merge)) - die("You need to resolve your current index first"); - prefix_set = opts.prefix ? 1 : 0; if (1 < opts.merge + opts.reset + prefix_set) die("Which one? -m, --reset, or --prefix?"); stage = opts.merge = (opts.reset || opts.merge || prefix_set); + if (opts.merge && read_cache_unmerged() && !opts.reset) + die("You need to resolve your current index first"); -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html