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

Re: [PATCH] cache.h: drop duplicate `ensure_full_index()` declaration

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 10, 2022, 19:30 UTC
Message-ID
<xmqqfspvz8us.fsf@gitster.g>
In-Reply-To
<c0a0798d-96fb-936b-3234-88e500eb86d0@github.com>
Victoria Dye <vdye@github.com> writes:
Show 39 quoted lines
> Martin Ågren wrote:
>> There are two identical declarations of `ensure_full_index()` in
>> cache.h.
>> 
>> Commit 3964fc2aae ("sparse-index: add guard to ensure full index",
>> 2021-03-30) provided an empty implementation of `ensure_full_index()`,
>> declaring it in a new file sparse-index.h. When commit 4300f8442a
>> ("sparse-index: implement ensure_full_index()", 2021-03-30) fleshed out
>> the implementation, it added an identical declaration to cache.h.
>> 
>> Then 118a2e8bde ("cache: move ensure_full_index() to cache.h",
>> 2021-04-01) favored having the declaration in cache.h. Because of the
>> double declaration, at that point we could have just dropped the one in
>> sparse-index.h, but instead it got moved to cache.h.
>> 
>> As a result, cache.h contains the exact same function declaration twice.
>> Drop the one under "/* Name hashing */", in favor of the one under
>> "/* Initialize and use the cache information */".
>> 
>> Signed-off-by: Martin Ågren <martin.agren@gmail.com>
>> ---
>>  cache.h | 2 --
>>  1 file changed, 2 deletions(-)
>> 
>> diff --git a/cache.h b/cache.h
>> index 5d7463e6fb..281f00ab1b 100644
>> --- a/cache.h
>> +++ b/cache.h
>> @@ -350,8 +350,6 @@ void add_name_hash(struct index_state *istate, struct cache_entry *ce);
>>  void remove_name_hash(struct index_state *istate, struct cache_entry *ce);
>>  void free_name_hash(struct index_state *istate);
>>  
>> -void ensure_full_index(struct index_state *istate);
>> -
>>  /* Cache entry creation and cleanup */
>>  
>>  /*
>
> Thanks for cleaning up the duplicate, looks good to me!
Thanks, both.
Previous: Victoria DyeNext: Junio C Hamano
Message 3 of 4 in “cache.h: drop duplicate `ensure_full_index()` declaration”
  1. cache.h: drop duplicate `ensure_full_index()` declarationMartin Ågren, Jan 10, 2022
  2. Victoria DyeJan 10, 2022
  3. Junio C HamanoJan 10, 2022
  4. A couple more duplicate declarationsJunio C Hamano, Jan 10, 2022

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.