简体   繁体   中英

Why does git log --name-only downloads further objects for repos with --filter=blob:none

Given I cloned a repository with:

git clone --filter=blob:none --no-checkout <url>

Now the following command is really fast as expect:

git log --oneline -- '**/somefile'

However this command is very slow, despite the fact, that all information should be in the tree files which are already downloaded:

git log --oneline --name-only -- '**/somefile'

Checking the background activity, it is visible that git fetches further objects. Can this be avoided somehow? I need to get the full path of the file(s) in the commits.

The only option I can see is to do the plumbing myself, eg use something like gitpython to run over the raw tree objects. However, I would rather use pure git commands to archive the task (find all commits with a given filename/basename).

Fastest way to do it is going to be

git log --pretty=%H -- '**/somefile' | git diff-tree -r --stdin --name-only

and then fill in the subject lines as needed, say an awk to supply them from a sideband git rev-list --oneline --no-abbrev @

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM