I want a bare, shallow clone of a git repo with no file contents, as all I'm interested in are the file paths themselves. This works great:
$ git clone --bare --depth=1 --filter=blob:none --branch="118.0.5977.1" "https://github.com/chromium/chromium.git"
Cloning into bare repository 'chromium.git'...
remote: Enumerating objects: 34624, done.
remote: Counting objects: 100% (34624/34624), done.
remote: Compressing objects: 100% (25673/25673), done.
remote: Total 34624 (delta 1647), reused 21869 (delta 1304), pack-reused 0
Receiving objects: 100% (34624/34624), 13.72 MiB | 16.20 MiB/s, done.
Resolving deltas: 100% (1647/1647), done.
It completes in about 3 seconds, and takes up only 15 MiB on disk. I can get the paths with git ls-tree -r HEAD
.
However, various git commands seem to want to fetch additional data from the remote repo. For example
$ cd chromium.git
$ git log
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (1/1), 372 bytes | 372.00 KiB/s, done.
commit 58a2c380702a84b362d0ee74ffc1e53e937770dd (grafted, HEAD, tag: 118.0.5977.1)
...
Can I tell git not to do this? I would prefer the command to fail rather than fetch any additional data from the remote.