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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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..

-- 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
--
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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]