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

Re: reset reports file as modified when it's in fact deleted

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 11, 2011, 16:43 UTC
Message-ID
<7vr51er4nd.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20111111140834.GA10025@beez.lab.cmartin.tk>
Carlos Martín Nieto <cmn@elego.de> writes:
Show 22 quoted lines
> 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.

Previous: Carlos Martín NietoNext: Jeff King
Message 4 of 18 in “reset reports file as modified when it's in fact deleted”
  1. Carlos Martín NietoNov 7, 2011
  2. Jeff KingNov 7, 2011
  3. Carlos Martín NietoNov 11, 2011
  4. Junio C HamanoNov 11, 2011
  5. Jeff KingNov 11, 2011
  6. Junio C HamanoNov 12, 2011
  7. Jeff KingNov 14, 2011
  8. 1/4 refresh_index: rename format variablesJeff King, Nov 14, 2011
  9. 2/4 refresh_index: mark deletions in porcelain outputJeff King, Nov 14, 2011
  10. 3/4 read-cache: let refresh_cache_ent pass up changed flagsJeff King, Nov 14, 2011
  11. 4/4 refresh_index: notice typechanges in outputJeff King, Nov 14, 2011
  12. Junio C HamanoNov 15, 2011
  13. Jeff KingNov 15, 2011
  14. Jeff KingNov 18, 2011
  15. 1/3 read-cache: let refresh_cache_ent pass up changed flagsJeff King, Nov 18, 2011
  16. 2/3 refresh_index: rename format variablesJeff King, Nov 18, 2011
  17. 3/3 refresh_index: make porcelain output more specificJeff King, Nov 18, 2011
  18. Junio C HamanoNov 18, 2011

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.