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

Re: git-add has gone lstat() mad

From
APAndy Parkins <andyparkins@gmail.com>
Date
Mar 30, 2007, 20:20 UTC
Message-ID
<200703302120.23713.andyparkins@gmail.com>
In-Reply-To
<200703302055.13619.andyparkins@gmail.com>
On Friday 2007, March 30, Andy Parkins wrote:
> At this point the CPU pegs at 100% systime.  An strace shows that git
> is calling lstat64() on every file in my home directory.  I killed
> git before it scanned everything I've ever done.

Okay. I've tracked down the culprit function, but I have no idea what the fix is.

builtin-add.c:fill_directory() calls dir.c:read_directory() which calls dir.c:read_directory_recursive()

I can't see why git feels that it has to recurse the entire subtree. It seems to be something to do with the gitignore stuff. Surely there is no need to use a recursive search when no directories are being added?

If git-add were given
 file1
 dir1/file2
 dir2/dir3/file3

Then only the directories "."; "dir1/"; "dir2"; and "dir2/dir3" need checking for .gitignore files; and in none of those cases does the search need to be recursive.

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com
Previous: Andy ParkinsNext: Junio C Hamano
Message 2 of 10 in “git-add has gone lstat() mad”
  1. Andy ParkinsMar 30, 2007
  2. Andy ParkinsMar 30, 2007
  3. Junio C HamanoMar 31, 2007
  4. Linus TorvaldsMar 31, 2007
  5. Andy ParkinsMar 31, 2007
  6. Randal L. SchwartzMar 31, 2007
  7. Andy ParkinsMar 31, 2007
  8. Tom PrinceMar 31, 2007
  9. Junio C HamanoApr 1, 2007
  10. Andy ParkinsApr 1, 2007

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.