git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Carlos Martín Nieto" <cmn@elego.de>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: reset reports file as modified when it's in fact deleted
Date: Fri, 11 Nov 2011 08:43:34 -0800	[thread overview]
Message-ID: <7vr51er4nd.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20111111140834.GA10025@beez.lab.cmartin.tk> ("Carlos Martín Nieto"'s message of "Fri, 11 Nov 2011 15:08:34 +0100")

Carlos Martín Nieto <cmn@elego.de> writes:

> On Mon, Nov 07, 2011 at 11:26:42AM -0500, Jeff King wrote:
> ...
>> The patch to do "D"eleted is pretty simple:
>> 
>> diff --git a/read-cache.c b/read-cache.c
>> index dea7cd8..cc1ebdf 100644
>> --- a/read-cache.c
>> +++ b/read-cache.c
>> @@ -1103,9 +1103,11 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
>>  	int in_porcelain = (flags & REFRESH_IN_PORCELAIN);
>>  	unsigned int options = really ? CE_MATCH_IGNORE_VALID : 0;
>>  	const char *needs_update_fmt;
>> +	const char *needs_rm_fmt;
>>  	const char *needs_merge_fmt;
>>  
>>  	needs_update_fmt = (in_porcelain ? "M\t%s\n" : "%s: needs update\n");
>> +	needs_rm_fmt = (in_porcelain ? "D\t%s\n" : "%s: needs update\n");
>>  	needs_merge_fmt = (in_porcelain ? "U\t%s\n" : "%s: needs merge\n");
>
> While the name fits in with the rest of the variables, it's kind of
> the wrong way around, isn't it? It doesn't need an 'rm', it /was/
> rm'd.

The variable names were chosen to mean "In a situation where the plumbing
traditionally would have said X, use this format to describe it". This is
the first topic to separate a single situation (from the plumbing's point
of view) into two and say different things at Porcelain, and the variable
naming no longer works.

An obvious solution would be to rename all of them to be based on "what
happened to the path". E.g. "modified_fmt" would be set to either "M" or
"needs update", and "removed_fmt" would be set to either "D" or "needs
update", etc.

  reply	other threads:[~2011-11-11 16:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-07  9:43 reset reports file as modified when it's in fact deleted Carlos Martín Nieto
2011-11-07 16:26 ` Jeff King
2011-11-11 14:08   ` Carlos Martín Nieto
2011-11-11 16:43     ` Junio C Hamano [this message]
2011-11-11 18:21       ` Jeff King
2011-11-12  0:11         ` Junio C Hamano
2011-11-14 22:50           ` Jeff King
2011-11-14 22:51             ` [PATCH 1/4] refresh_index: rename format variables Jeff King
2011-11-14 22:52             ` [PATCH 2/4] refresh_index: mark deletions in porcelain output Jeff King
2011-11-14 22:52             ` [PATCH 3/4] read-cache: let refresh_cache_ent pass up changed flags Jeff King
2011-11-14 22:56             ` [PATCH 4/4] refresh_index: notice typechanges in output Jeff King
2011-11-15  0:08               ` Junio C Hamano
2011-11-15  2:05                 ` Jeff King
2011-11-18 11:09                   ` Jeff King
2011-11-18 11:11                     ` [PATCHv2 1/3] read-cache: let refresh_cache_ent pass up changed flags Jeff King
2011-11-18 11:11                     ` [PATCHv2 2/3] refresh_index: rename format variables Jeff King
2011-11-18 11:13                     ` [PATCH 3/3] refresh_index: make porcelain output more specific Jeff King
2011-11-18 20:40                     ` [PATCH 4/4] refresh_index: notice typechanges in output 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=7vr51er4nd.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=cmn@elego.de \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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).