builtin/cat-file: support "blob:none" objects filter

Implement support for the "blob:none" filter in git-cat-file(1), which
causes us to omit all blobs.

Note that this new filter requires us to read the object type via
`oid_object_info_extended()` in `batch_object_write()`. But as we try to
optimize away reading objects from the database the `data->info.typep`
pointer may not be set. We thus have to adapt the logic to conditionally
set the pointer in cases where the filter is given.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2025-04-02 13:13:39 +02:00
committed by Junio C Hamano
parent eb83e4c64b
commit 3794e9bf98
3 changed files with 62 additions and 4 deletions

View File

@@ -88,7 +88,9 @@ OPTIONS
been explicitly requested via any of the batch modes that read objects
via standard input (`--batch`, `--batch-check`) will be reported as
"filtered". Excluded objects in `--batch-all-objects` mode will not be
printed at all. No filters are supported yet.
printed at all. The '<filter-spec>' may be one of the following:
+
The form '--filter=blob:none' omits all blobs.
--path=<path>::
For use with `--textconv` or `--filters`, to allow specifying an object