-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bug
In Windows, git lfs track takes 20+ seconds to execute. I have experienced this issue for some time now. Some few months ago everything was good and I do not know what happened for the problem to show up (I use a corporate computer I do not have full control of). I guess the issue depends on my machine configuration and most likely not everybody can reproduce it.
This delay is very annoying because the HMI I use (Sourcetree) runs the command any time I stage a file.
See #5254
Using export GIT_TRACE=1, I get:
$ git lfs track
11:35:51.001836 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
11:35:51.001836 git.c:725 trace: exec: git-lfs track
11:35:51.001836 run-command.c:655 trace: run_command: git-lfs track
11:35:51.032212 trace git-lfs: exec: git 'version'
11:35:51.144849 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' '--git-dir' '--show-toplevel'
11:35:51.220515 trace git-lfs: exec: uname
11:35:51.300364 trace git-lfs: exec: git 'config' '--includes' '--local' 'lfs.repositoryformatversion'
11:35:51.375237 trace git-lfs: exec: git 'config' '--includes' '-l'
11:35:51.440847 trace git-lfs: exec: git 'rev-parse' '--is-bare-repository'
11:35:51.515246 trace git-lfs: exec: git 'config' '--includes' '-l' '--blob' ':.lfsconfig'
11:35:51.581437 trace git-lfs: exec: git 'config' '--includes' '-l' '--blob' 'HEAD:.lfsconfig'
11:35:51.647150 trace git-lfs: Install hook: pre-push, force=false, path=C:\my_repo\.git\hooks\pre-push, upgrading...
11:35:51.657459 trace git-lfs: Install hook: post-checkout, force=false, path=C:\my_repo\.git\hooks\post-checkout, upgrading...
11:35:51.666852 trace git-lfs: Install hook: post-commit, force=false, path=C:\my_repo\.git\hooks\post-commit, upgrading...
11:35:51.675851 trace git-lfs: Install hook: post-merge, force=false, path=C:\my_repo\.git\hooks\post-merge, upgrading...
11:36:14.267778 trace git-lfs: NewLsFiles: running in C:\my_repo git ls-files -z --cached --sparse --exclude-standard --others
11:36:14.267778 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'ls-files' '-z' '--cached' '--sparse' '--exclude-standard' '--others'
11:36:14.343443 trace git-lfs: findAttributeFiles: located .gitattributes
Listing tracked patterns
... there follows a correct list of patterns ...
Listing excluded patterns
11:36:14.353523 trace git-lfs: filepathfilter: creating pattern ".git" of type gitignore
11:36:14.353523 trace git-lfs: filepathfilter: creating pattern "**/.git" of type gitignore
11:36:14.353523 trace git-lfs: filepathfilter: accepting "tmp"
11:36:14.582394 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
11:36:14.590787 git.c:439 trace: built-in: git config --bool core.sparseCheckout
As you see, there is a 23 sec interval between the pos-merge hook installation and the NewLsFiles trace.
To Reproduce
Simply type git lfs track when inside a repository.
Expected behavior
The command should finish nearly immediately.
System environment
Windows 10.0.19045 Build 19045
git version 2.40.0.windows.1
git-lfs/3.3.0 (GitHub; windows amd64; go 1.19.3; git 77deabd)
Output of git lfs env
$ git lfs env
git-lfs/3.3.0 (GitHub; windows amd64; go 1.19.3; git 77deabdf)
git version 2.40.0.windows.1
Endpoint=https://xxx.com/git/yyy/lfs (auth=basic)
LocalWorkingDir=C:\my_repo
LocalGitDir=C:\my_repo\.git
LocalGitStorageDir=C:\my_repo\.git
LocalMediaDir=C:\my_repo\.git\lfs\objects
LocalReferenceDirs=
TempDir=C:\my_repo\.git\lfs\tmp
ConcurrentTransfers=8
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=C:\my_repo\.git\lfs
AccessDownload=basic
AccessUpload=basic
DownloadTransfers=basic,lfs-standalone-file,ssh
UploadTransfers=basic,lfs-standalone-file,ssh
GIT_EXEC_PATH=C:/Program Files/Git/mingw64/libexec/git-core
GIT_TRACE=0
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"