git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 5/8] checkout(-index): do not checkout i-t-a entries

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 30, 2015, 19:17 UTC
Message-ID
<xmqq1tb78fgs.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20151129153122.GA3719@duynguyen-vnpc.dek-tpc.internal>
Duy Nguyen <pclouds@gmail.com> writes:
Show 30 quoted lines
> 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.
Show 28 quoted lines
> -- 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
Previous: Duy NguyenNext: Nguyễn Thái Ngọc Duy
Message 22 of 28 in “apply --cached --whitespace=fix now failing on items added with "add -N"”
  1. Patrick HigginsJun 22, 2015
  2. Duy NguyenJun 22, 2015
  3. Junio C HamanoJun 22, 2015
  4. apply: fix adding new files on i-t-a entriesNguyễn Thái Ngọc Duy, Jun 23, 2015
  5. Junio C HamanoJun 23, 2015
  6. Junio C HamanoJun 23, 2015
  7. Junio C HamanoJun 24, 2015
  8. Duy NguyenJun 24, 2015
  9. Junio C HamanoJun 24, 2015
  10. Duy NguyenJun 25, 2015
  11. Junio C HamanoJun 25, 2015
  12. 0/8 Resurrect "diff-lib.c: adjust position of i-t-a entries in diff"Nguyễn Thái Ngọc Duy, Aug 22, 2015
  13. 1/8 blame: remove obsolete commentNguyễn Thái Ngọc Duy, Aug 22, 2015
  14. 2/8 Add and use convenient macro ce_intent_to_add()Nguyễn Thái Ngọc Duy, Aug 22, 2015
  15. 3/8 apply: fix adding new files on i-t-a entriesNguyễn Thái Ngọc Duy, Aug 22, 2015
  16. Junio C HamanoAug 25, 2015
  17. 4/8 apply: make sure check_preimage() does not leave empty file on errorNguyễn Thái Ngọc Duy, Aug 22, 2015
  18. Junio C HamanoAug 25, 2015
  19. 5/8 checkout(-index): do not checkout i-t-a entriesNguyễn Thái Ngọc Duy, Aug 22, 2015
  20. Junio C HamanoAug 25, 2015
  21. Duy NguyenNov 29, 2015
  22. Junio C HamanoNov 30, 2015
  23. 6/8 grep: make it clear i-t-a entries are ignoredNguyễn Thái Ngọc Duy, Aug 22, 2015
  24. 7/8 diff.h: extend "flags" field to 64 bits because we're out of bitsNguyễn Thái Ngọc Duy, Aug 22, 2015
  25. Junio C HamanoAug 25, 2015
  26. Duy NguyenAug 31, 2015
  27. Junio C HamanoAug 25, 2015
  28. Junio C HamanoAug 25, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.