From: Stephen Boyd <bebarino@gmail.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Alexandre Julliard <julliard@winehq.org>, git@vger.kernel.org
Subject: Re: [PATCH] read-tree: Fix regression with creation of a new index file.
Date: Mon, 17 Aug 2009 20:37:11 -0700 [thread overview]
Message-ID: <4A8A21E7.7070001@gmail.com> (raw)
In-Reply-To: <alpine.DEB.1.00.0908180018020.8306@pacific.mpi-cbg.de>
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");
prev parent reply other threads:[~2009-08-18 3:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-17 15:35 [PATCH] read-tree: Fix regression with creation of a new index file Alexandre Julliard
2009-08-17 22:19 ` Johannes Schindelin
2009-08-18 3:37 ` Stephen Boyd [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A8A21E7.7070001@gmail.com \
--to=bebarino@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=julliard@winehq.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox