[Question] Can git cat-file have a type filtering option?
- From
ZheNing Hu <adlternative@gmail.com>
- Date
- Apr 7, 2023, 14:24 UTC
- Message-ID
- <CAOLTT8RTB7kpabN=Rv1nHvKTaYh6pLR6moOJhfC2wdtUG_xahQ@mail.gmail.com>
Sometimes when we use `git cat-file --batch-all-objects`, we only want data of type "blob". In order to filter them out, we may need to use some additional processes (such as `git rev-list --objects --filter=blob:none --filter-provided-objects`) to obtain the SHA of all blobs, and then use `git cat-file --batch` to retrieve them. This is not very elegant, or in other words, it might be better to have an internal implementation of filtering within `git cat-file --batch-all-objects`.
However, `git cat-file` already has a `--filters` option, which is used to "show content as transformed by filters". I'm not sure if there is a better word to implement the functionality of filtering by type? For example, `--type-filter`?
Thanks, -- ZheNing Hu