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

Re: git status reads too many files

From
Lasse Makholm <lasse.makholm@gmail.com>
Date
Mar 21, 2011, 20:39 UTC
Message-ID
<AANLkTikPL7Dx5AphGnd1TVAyLNgNh2WVd__Yom134VXb@mail.gmail.com>
In-Reply-To
<7vipvcs9xt.fsf@alter.siamese.dyndns.org>
On 21 March 2011 17:41, Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
> Lasse Makholm <lasse.makholm@gmail.com> writes:
>
>> This persistent across multiple runs of git status:
>>
>> $ strace -o /tmp/trace2 git status
>> # On branch there
>> nothing to commit (working directory clean)
>> $ grep ^open /tmp/trace2 | wc -l
>> 414
>> $
>>
>> ...until the index is touched:
>>
>> $ touch .git/index
>
> Don't do this; you are breaking the racy-git protection.

Yeah, I know, I was just proving a point... git reset (--hard?) HEAD would achieve the same thing...

Show 5 quoted lines
> I think we opportunistically update the .git/index file in "git status" to
> refresh the stat bits (but we don't error out when we cannot write a new
> index, as you may be only browsing somebody else's repository with only a
> read access to it).  It probably should be just the matter of adding a bit
> of logic to notice that your index is racily clean.

I figured as much... My original thought of checkout ensuring an index newer than any working file is stupid, of course, for a multitude of reasons -- one of which is that the "next" timestamp may be a full 2 seconds away...

> Let me cook something real quick.
Sweet, thanks...
-- 
/Lasse
Previous: Eric Raible
Message 9 of 9 in “git status reads too many files”
  1. Lasse MakholmMar 21, 2011
  2. Junio C HamanoMar 21, 2011
  3. 1/2 diff/status: refactor opportunistic index updateJunio C Hamano, Mar 21, 2011
  4. Piotr KrukowieckiMar 21, 2011
  5. Junio C HamanoMar 21, 2011
  6. 2/2 update $GIT_INDEX_FILE when there are racily clean entriesJunio C Hamano, Mar 21, 2011
  7. Lasse MakholmMar 21, 2011
  8. Eric RaibleMar 22, 2011
  9. Lasse MakholmMar 21, 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.