git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Lehmann <Jens.Lehmann@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC PATCH] unpack-trees: add check_worktree flag to enable dry-run functionality
Date: Thu, 19 May 2011 20:21:52 +0200	[thread overview]
Message-ID: <4DD55FC0.4000505@web.de> (raw)
In-Reply-To: <7vei3u7e25.fsf@alter.siamese.dyndns.org>

Am 19.05.2011 20:14, schrieb Junio C Hamano:
> Jens Lehmann <Jens.Lehmann@web.de> writes:
> 
>>>> +	if (opts.update && dry_run)
>>>> +		opts.update = 0;
>>>
>>> ... this hunk must go, right?
>>
>> But this is the "don't update the work tree when -n is used together
>> with -u" part, so it is needed, no? With this patch applied first and
>> opts.check_worktree set to 1 inside that if() added there all tests
>> succeed.
> 
> I would say the natural way to do your "dry-run" would be to change the
> inner guts of unpack_trees() codepath that currently does
> 
> 	if (opts.update) {
> 		if (do something to the work tree and get non-zero on failure)
> 			die("... cannot update '%s'", path);
> 	}
> 
> with your "-n" work to
> 
> 	if (opts.update) {
>         	if (opts.dry_run) {
> 			if (would the work tree operation fail?)
> 				say("... update would fail because ... '%s'", path);
> 		} else {
> 			if (do something to the work tree and get non-zero on failure)
> 				die("... cannot update '%s'", path);
> 		}
> 	}
> 
> and that was why I thought you would want to keep the original value of
> opts.update. I wouldn't think of a good way to make the code that kicks
> in when both update and dry_run are set if you clear update that early in
> the codepath.

Ah, now I get it ... Thanks, will add a dry_run flag that keeps update
from changing anything.

      reply	other threads:[~2011-05-19 18:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-13 20:03 What's cooking in git.git (May 2011, #06; Fri, 13) Junio C Hamano
2011-05-14  3:03 ` Nguyen Thai Ngoc Duy
2011-05-14 17:37   ` Junio C Hamano
2011-05-15  4:51     ` Nguyen Thai Ngoc Duy
2011-05-15 16:50 ` Jens Lehmann
2011-05-15 20:23   ` Junio C Hamano
2011-05-17 19:43     ` [WIP PATCH] Teach read-tree the -n|--dry-run option Jens Lehmann
2011-05-17 21:15       ` Jens Lehmann
2011-05-17 22:47       ` Junio C Hamano
2011-05-19 17:47         ` [RFC PATCH] unpack-trees: add check_worktree flag to enable dry-run functionality Jens Lehmann
2011-05-19 18:14           ` Junio C Hamano
2011-05-19 18:21             ` Jens Lehmann [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=4DD55FC0.4000505@web.de \
    --to=jens.lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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;
as well as URLs for NNTP newsgroup(s).