git-lfs / git-lfs

Git extension for versioning large files
https://git-lfs.com
Other
12.81k stars 2.01k forks source link

git lfs ls-files --all -ls should print out exact size #5823

Open axkibe opened 1 month ago

axkibe commented 1 month ago

Describe the issue I want to create a list of all LFS files actually in use of all repositories (excluding deleted repositories and aborted commits)

[Someone uploaded a huge amount of silly LFSs file I need to cleanup]

In my LFS system I used the file size as part of the identification of the file.

With git lfs ls-files- --all -ls I'm missing that info. Also at the end of the filename it's hard to parse.

Ideally would be a --format option like many other git commands haven then I could do: --format="%O-%S".

chrisd8088 commented 1 month ago

Hey, thanks for the suggestion! I'll mark this as a possible enhancement and put it on our backlog.

In the meantime, if anyone has time to write up a patch to introduce this functionality (and some tests to go with it), we are always appreciative of contributions to the project!

axkibe commented 1 month ago

Since I got a database of all LFS stored objects I can just look that through to build a table to get the sizes to get the full keys. It's just an extra step for me. Reading the docs back then I got the idea it's up to the implementation if oids alone or oids+size are used to identify objects and with size it sounded like a cheap way for extra safety against collisions.

I tried before to hack something to git-lfs, but I must say, since it is Go I could not make heads or tails out of it.

Another wish for ls-files I would like to exclude not a path but a specific commit hash (that commit which uploaded a lot of unnessary files) while I can easily get of course all the oids+sizes from the commit, I cannot easily tell, if they arent used elsewhere (unlikely, but possible)