git-add has gone lstat() mad

2 messages, 1 author, 2016-06-15 · open the first message on its own page

git-add has gone lstat() mad

From: Andy Parkins <hidden>
Date: 2016-06-15 22:43:02

Hello,

I was interested in trying out the GIT_WORK_DIR stuff, but ended up 
being unable to.  The thing that stopped me is present in master as 
well:

 $ git --version
 git version 1.5.1.rc3.20.gaa453
 $ cd $HOME
 $ git init
 $ git add .bashrc

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.

I only want to track one file; is git meant to scan every file in the 
directory even though I'm not adding any of them?



Andy
-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com

Re: git-add has gone lstat() mad

From: Andy Parkins <hidden>
Date: 2016-06-15 22:43:02

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help