Signed-off-by: Alexander Kuleshov <kuleshovmail@xxxxxxxxx> --- Documentation/git-cat-file.txt | 5 +++-- builtin/cat-file.c | 4 ++-- t/t8007-cat-file-textconv.sh | 10 ++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt index f6a16f4..b346a5d 100644 --- a/Documentation/git-cat-file.txt +++ b/Documentation/git-cat-file.txt @@ -9,14 +9,14 @@ git-cat-file - Provide content or type and size information for repository objec SYNOPSIS -------- [verse] -'git cat-file' (-t | -s | -e | -p | <type> | --textconv ) <object> +'git cat-file' (-t | -s | -e | -p | <type> | (-c | --textconv) ) <object> 'git cat-file' (--batch | --batch-check) < <list-of-objects> DESCRIPTION ----------- In its first form, the command provides the content or the type of an object in the repository. The type is required unless '-t' or '-p' is used to find the -object type, or '-s' is used to find the object size, or '--textconv' is used +object type, or '-s' is used to find the object size, or '-c/--textconv' is used (which implies type "blob"). In the second form, a list of objects (separated by linefeeds) is provided on @@ -52,6 +52,7 @@ OPTIONS or to ask for a "blob" with <object> being a tag object that points at it. +-c --textconv:: Show the content as transformed by a textconv filter. In this case, <object> has be of the form <tree-ish>:<path>, or :<path> in order diff --git a/builtin/cat-file.c b/builtin/cat-file.c index f8d8129..a8154a0 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -329,7 +329,7 @@ static int batch_objects(struct batch_options *opt) } static const char * const cat_file_usage[] = { - N_("git cat-file (-t|-s|-e|-p|<type>|--textconv) <object>"), + N_("git cat-file (-t|-s|-e|-p|<type>|(-c|--textconv)) <object>"), N_("git cat-file (--batch|--batch-check) < <list_of_objects>"), NULL }; @@ -373,7 +373,7 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix) OPT_SET_INT('e', NULL, &opt, N_("exit with zero when there's no error"), 'e'), OPT_SET_INT('p', NULL, &opt, N_("pretty-print object's content"), 'p'), - OPT_SET_INT(0, "textconv", &opt, + OPT_SET_INT('c', "textconv", &opt, N_("for blob objects, run textconv on object's content"), 'c'), { OPTION_CALLBACK, 0, "batch", &batch, "format", N_("show info and content of objects fed from the standard input"), diff --git a/t/t8007-cat-file-textconv.sh b/t/t8007-cat-file-textconv.sh index eacd49a..994c5b0 100755 --- a/t/t8007-cat-file-textconv.sh +++ b/t/t8007-cat-file-textconv.sh @@ -24,6 +24,11 @@ bin: test version 2 EOF test_expect_success 'no filter specified' ' + git cat-file -c :one.bin >result && + test_cmp expected result +' + +test_expect_success 'no filter specified' ' git cat-file --textconv :one.bin >result && test_cmp expected result ' @@ -52,6 +57,11 @@ cat >expected <<EOF converted: test version 2 EOF +test_expect_success 'cat-file -c on last commit' ' + git cat-file -c :one.bin >result && + test_cmp expected result +' + test_expect_success 'cat-file --textconv on last commit' ' git cat-file --textconv :one.bin >result && test_cmp expected result -- 2.2.1.522.g2561c04.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html