When third-party tools need to access to contents of blobs in the
database, they might be more interested in the worktree version than in
the "clean" version of said contents.
This branch introduces the --filters option to make that happen, the
--use-path option to provide the path separately if the blob name rather
than the tree name is availale, and offers batch support in which case
it expects the object names and the path on its input lines, separated
by white space.
The new --filters option is an obvious sibling of --textconv, and shares
the peculiar feature that the drivers (and end-of-line convention) are
determined from the current worktree, not from the attributes stored in
the revision that may have been part of the object name.
As --textconv is so similar to --filters, it was taught to understand
the --use-path option and it was made compatible with batch mode, too.
I briefly considered teaching the batch mode to extract the path from
object names if they are specified as <tree-ish>:<path>. The changes
would be quite intrusive, though, and uglify the code substanitially. So
I decided against that.
Changes vs v2:
- always override unknown mode to imply 0100644, even if the user did
not specify the --path option.
Johannes Schindelin (4):
cat-file: fix a grammo in the man page
cat-file: introduce the --filters option
cat-file --textconv/--filters: allow specifying the path separately
cat-file: support --textconv/--filters in batch mode
Documentation/git-cat-file.txt | 40 +++++++++++----
builtin/cat-file.c | 110 ++++++++++++++++++++++++++++++++++++++---
t/t8010-cat-file-filters.sh | 64 ++++++++++++++++++++++++
3 files changed, 196 insertions(+), 18 deletions(-)
create mode 100755 t/t8010-cat-file-filters.sh
Fetch-It-Via: git fetch https://github.com/dscho/git cat-file-filters-v3
Interdiff vs v2:
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index f8a3a08..4461153 100644
@@ -71,7 +71,7 @@ static int cat_one_file(int opt, const char *exp_type, const
path = obj_context.path;
- else if (obj_context.mode == S_IFINVALID)
+ if (obj_context.mode == S_IFINVALID)
obj_context.mode = 0100644;
buf = NULL;