github / git-sizer

Compute various size metrics for a Git repository, flagging those that might cause problems
MIT License
3.48k stars 139 forks source link

Impove NewObjectIter method #95

Closed Cactusinhand closed 2 years ago

Cactusinhand commented 2 years ago

Hi @mhagger

To get all objects in git repo, I wonder if git cat-file --batch-check='%(objectname) %(objecttype) %(objectsize)' --batch-all-objects is more effective and easier than git rev-list --objects --stdin && git cat-file --batch-check --buffer.

mhagger commented 2 years ago

@Cactusinhand: Thanks for the suggestion. Indeed, --batch-all-objects is a fast way to enumerate all objects. But git-sizer (a) only wants to process reachable objects, and (b) depends critically on objects being returned in "parent-to-child" order. I don't think that --batch-all-objects has either of those properties. So I don't think that this would be easy to change.

Cactusinhand commented 2 years ago

@Cactusinhand: Thanks for the suggestion. Indeed, --batch-all-objects is a fast way to enumerate all objects. But git-sizer (a) only wants to process reachable objects, and (b) depends critically on objects being returned in "parent-to-child" order. I don't think that --batch-all-objects has either of those properties. So I don't think that this would be easy to change.

Oh, I get it. Thanks for your reply.