public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Duy Nguyen <pclouds@gmail•com>
Cc: git@vger•kernel.org, phiggins@google•com, snoksrud@gmail•com
Subject: Re: [PATCH 5/8] checkout(-index): do not checkout i-t-a entries
Date: Mon, 30 Nov 2015 11:17:07 -0800	[thread overview]
Message-ID: <xmqq1tb78fgs.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20151129153122.GA3719@duynguyen-vnpc.dek-tpc.internal> (Duy Nguyen's message of "Sun, 29 Nov 2015 16:31:22 +0100")

Duy Nguyen <pclouds@gmail•com> writes:

> Sorry for this waaay too late response, everything (of the series
> nd/ita-cleanup) is addressed so far except this..
>
> On Tue, Aug 25, 2015 at 10:36:52AM -0700, Junio C Hamano wrote:
>> > diff --git a/builtin/checkout.c b/builtin/checkout.c
>> > index e1403be..02889d4 100644
>> > --- a/builtin/checkout.c
>> > +++ b/builtin/checkout.c
>> > @@ -300,6 +300,8 @@ static int checkout_paths(const struct checkout_opts *opts,
>> >  			 * anything to this entry at all.
>> >  			 */
>> >  			continue;
>> > +		if (ce_intent_to_add(ce))
>> > +			continue;
>> >  		/*
>> >  		 * Either this entry came from the tree-ish we are
>> >  		 * checking the paths out of, or we are checking out
>> 
>> Hmm, while this does prevent the later code from checking it out, I
>> am not sure how well this interacts with ps_matched[] logic here.
>> If the user told Git that 'foo' is a path that she cares about with
>> "add -N foo", and said "git checkout -- foo", should we be somehow
>> saying that 'foo' did match but there is nothing to check out, or
>> something?
>
> How about this? It does not mess with ps_matched logic. But it does
> not say "nothing to checkout" at the end either. While we could do
> that (in general case, not just because all we are checking out is ita
> entries), I'm not sure if such verbosity helps anyone. I'm thinking of
> dropping the new warning I added here too..

I agree that these warnings are unwanted when you run "checkout ."
in a repository with tons of i-t-a paths (but on the other hand,
having tons of i-t-a paths is unusual so the user might want to be
reminded of them--I dunno).

With or without the new warning(), this one looks an improvement
over the previous one to me.

Thanks.

> -- 8< --
> diff --git a/builtin/checkout.c b/builtin/checkout.c
> index 3e141fc..c11fe71 100644
> --- a/builtin/checkout.c
> +++ b/builtin/checkout.c
> @@ -328,12 +328,17 @@ static int checkout_paths(const struct checkout_opts *opts,
>  	if (opts->merge)
>  		unmerge_marked_index(&the_index);
>  
> -	/* Any unmerged paths? */
>  	for (pos = 0; pos < active_nr; pos++) {
>  		const struct cache_entry *ce = active_cache[pos];
>  		if (ce->ce_flags & CE_MATCHED) {
> -			if (!ce_stage(ce))
> +			if (!ce_stage(ce)) {
> +				if (ce_intent_to_add(ce)) {
> +					warning(_("path '%s' is only intended to add"), ce->name);
> +					ce->ce_flags &= ~CE_MATCHED;
> +				}
>  				continue;
> +			}
> +			/* Any unmerged paths? */
>  			if (opts->force) {
>  				warning(_("path '%s' is unmerged"), ce->name);
>  			} else if (opts->writeout_stage) {
> -- 8< --
> --
> Duy

  reply	other threads:[~2015-11-30 19:17 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-22 14:29 apply --cached --whitespace=fix now failing on items added with "add -N" Patrick Higgins
2015-06-22 14:45 ` Duy Nguyen
2015-06-22 17:06   ` Junio C Hamano
2015-06-23 12:34 ` [PATCH] apply: fix adding new files on i-t-a entries Nguyễn Thái Ngọc Duy
2015-06-23 16:50   ` Junio C Hamano
2015-06-23 17:37     ` Junio C Hamano
2015-06-24  4:48     ` Junio C Hamano
2015-06-24 10:11     ` Duy Nguyen
2015-06-24 17:05       ` Junio C Hamano
2015-06-25 12:26         ` Duy Nguyen
2015-06-25 13:07           ` Junio C Hamano
2015-08-22  1:08             ` [PATCH 0/8] Resurrect "diff-lib.c: adjust position of i-t-a entries in diff" Nguyễn Thái Ngọc Duy
2015-08-22  1:08               ` [PATCH 1/8] blame: remove obsolete comment Nguyễn Thái Ngọc Duy
2015-08-22  1:08               ` [PATCH 2/8] Add and use convenient macro ce_intent_to_add() Nguyễn Thái Ngọc Duy
2015-08-22  1:08               ` [PATCH 3/8] apply: fix adding new files on i-t-a entries Nguyễn Thái Ngọc Duy
2015-08-25 17:01                 ` Junio C Hamano
2015-08-22  1:08               ` [PATCH 4/8] apply: make sure check_preimage() does not leave empty file on error Nguyễn Thái Ngọc Duy
2015-08-25 17:16                 ` Junio C Hamano
2015-08-22  1:08               ` [PATCH 5/8] checkout(-index): do not checkout i-t-a entries Nguyễn Thái Ngọc Duy
2015-08-25 17:36                 ` Junio C Hamano
2015-11-29 15:31                   ` Duy Nguyen
2015-11-30 19:17                     ` Junio C Hamano [this message]
2015-08-22  1:08               ` [PATCH 6/8] grep: make it clear i-t-a entries are ignored Nguyễn Thái Ngọc Duy
2015-08-22  1:11                 ` [PATCH 7/8] diff.h: extend "flags" field to 64 bits because we're out of bits Nguyễn Thái Ngọc Duy
2015-08-25 17:39                   ` Junio C Hamano
2015-08-31 10:22                     ` Duy Nguyen
2015-08-25 17:37                 ` [PATCH 6/8] grep: make it clear i-t-a entries are ignored Junio C Hamano
2015-08-25 17:37                 ` Junio C Hamano

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=xmqq1tb78fgs.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=pclouds@gmail$(echo .)com \
    --cc=phiggins@google$(echo .)com \
    --cc=snoksrud@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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