It would be a pity if an ignorant user copied a repository to another filesystem only to find out that certain operations suddenly break.
Perhaps the option should include the filesystem UUID for which the option should apply (to prevent these kinds of surprises).
it can by using `git update-index --test-untracked-cache` but it takes a long time to check this, so I guess they don't want to incur that penalty on every run.
OTOH,
>It would be a pity if an ignorant user copied a repository to another filesystem only to find out that certain operations suddenly break.
yes. I agree. The way this is handled at the moment is dangerous to the point of this not being worth it at all.
How about just writing a file to a scratch directory, and see if the mtime of the directory was changed?
The check you're talking about is one of the many checks it does, but there was further breakage which all needs to be checked against.
If so, they have to check every directory in the tree (or, alternatively, figure out all mount points in a different way, but I don't know whether that can be done efficiently in a portable way)
Once tested (or enabled without testing if you know what you're doing), the location of the repository and uname are recorded. If you copy the repository elsewhere, git should detect and disable the cache.
The reason it's disabled by default is first of all that it's relatively new, but secondly that if your FS stops behaving as expected (or you move your repo to one that doesn't behave) it'll degrade very badly, i.e. "git status" might now completely miss files that have been modified in your working tree.
But if you're just running a system where you know you can trust the FS you can use the untracked cache and get a lot of "git status" speed-up, which'll matter more the larger your checkout size is in terms of checked out directories & files.
% ~/g/git/git-update-index --test-untracked-cache
Testing mtime in '/media/psf/Home/Downloads/junk' .
directory stat info does not change after adding a new file