Jeff King <peff@xxxxxxxx> writes: > If a file changes type and a porcelain updates the index, we > will print "M file". Instead, let's be more specific and > print "T file", which matches actual diff and status output. > > The plumbing version remains "needs update" for historical > compatibility. > > Signed-off-by: Jeff King <peff@xxxxxxxx> > --- > The "changed" flag comes from refresh_cache_ent, which in turn gets it > from ie_modified_stat. The one hesitation I have is that intent-to-add > entries get the TYPE_CHANGED flag set, which means they will get a "T" > output. Whereas I actually think "M" is a little more sensible. I agree that we should not say that an intent-to-add entry has changed type relative to whatever, as by definition there is nothing to compare against. "A" that stands for "A"dd is a lot more sensible here, I would think. read-cache.c | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/read-cache.c b/read-cache.c index 0e17add..27e9fc6 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1108,11 +1108,13 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p const char *modified_fmt; const char *deleted_fmt; const char *typechange_fmt; + const char *added_fmt; const char *unmerged_fmt; modified_fmt = (in_porcelain ? "M\t%s\n" : "%s: needs update\n"); deleted_fmt = (in_porcelain ? "D\t%s\n" : "%s: needs update\n"); typechange_fmt = (in_porcelain ? "T\t%s\n" : "%s needs update\n"); + added_fmt = (in_porcelain ? "A\t%s\n" : "%s needs update\n"); unmerged_fmt = (in_porcelain ? "U\t%s\n" : "%s: needs merge\n"); for (i = 0; i < istate->cache_nr; i++) { struct cache_entry *ce, *new; @@ -1142,6 +1144,8 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p if (new == ce) continue; if (!new) { + const char *fmt; + if (not_new && cache_errno == ENOENT) continue; if (really && cache_errno == EINVAL) { @@ -1153,9 +1157,16 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p } if (quiet) continue; - show_file((cache_errno == ENOENT ? deleted_fmt : - changed & TYPE_CHANGED ? typechange_fmt : - modified_fmt), + + if (cache_errno == ENOENT) + fmt = deleted_fmt; + else if (ce->ce_flags & CE_INTENT_TO_ADD) + fmt = added_fmt; /* must be before other checks */ + else if (changed & TYPE_CHANGED) + fmt = typechange_fmt; + else + fmt = modified_fmt; + show_file(fmt, ce->name, in_porcelain, &first, header_msg); has_errors = 1; continue; -- 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