{"thread":{"id":"38323","subject":"[PATCH] cat-file: add short option '-c' for 'cat-file --textconv'","startedAt":"2015-01-09T08:47:59Z","lastAt":"2015-01-09T22:48:10Z","messageCount":2,"participants":["Alexander Kuleshov","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"254505","messageId":"1420793279-27853-1-git-send-email-kuleshovmail@gmail.com","threadId":"38323","inReplyTo":null,"subject":"[PATCH] cat-file: add short option '-c' for 'cat-file --textconv'","fromName":"Alexander Kuleshov","fromEmail":"kuleshovmail@gmail.com","sentAt":"2015-01-09T08:47:59Z","receivedAt":"2015-01-09T08:47:59Z","isPatch":true,"sender":{"key":"kuleshovmail@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2699235?v=4"},"body":"Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>\n---\n Documentation/git-cat-file.txt |  5 +++--\n builtin/cat-file.c             |  4 ++--\n t/t8007-cat-file-textconv.sh   | 10 ++++++++++\n 3 files changed, 15 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt\nindex f6a16f4..b346a5d 100644\n--- a/Documentation/git-cat-file.txt\n+++ b/Documentation/git-cat-file.txt\n@@ -9,14 +9,14 @@ git-cat-file - Provide content or type and size information for repository objec\n SYNOPSIS\n --------\n [verse]\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>\n \n DESCRIPTION\n -----------\n In its first form, the command provides the content or the type of an object in\n the repository. The type is required unless '-t' or '-p' is used to find the\n-object type, or '-s' is used to find the object size, or '--textconv' is used\n+object type, or '-s' is used to find the object size, or '-c/--textconv' is used\n (which implies type \"blob\").\n \n In the second form, a list of objects (separated by linefeeds) is provided on\n@@ -52,6 +52,7 @@ OPTIONS\n \tor to ask for a \"blob\" with <object> being a tag object that\n \tpoints at it.\n \n+-c\n --textconv::\n \tShow the content as transformed by a textconv filter. In this case,\n \t<object> has be of the form <tree-ish>:<path>, or :<path> in order\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex f8d8129..a8154a0 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -329,7 +329,7 @@ static int batch_objects(struct batch_options *opt)\n }\n \n static const char * const cat_file_usage[] = {\n-\tN_(\"git cat-file (-t|-s|-e|-p|<type>|--textconv) <object>\"),\n+\tN_(\"git cat-file (-t|-s|-e|-p|<type>|(-c|--textconv)) <object>\"),\n \tN_(\"git cat-file (--batch|--batch-check) < <list_of_objects>\"),\n \tNULL\n };\n@@ -373,7 +373,7 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)\n \t\tOPT_SET_INT('e', NULL, &opt,\n \t\t\t    N_(\"exit with zero when there's no error\"), 'e'),\n \t\tOPT_SET_INT('p', NULL, &opt, N_(\"pretty-print object's content\"), 'p'),\n-\t\tOPT_SET_INT(0, \"textconv\", &opt,\n+\t\tOPT_SET_INT('c', \"textconv\", &opt,\n \t\t\t    N_(\"for blob objects, run textconv on object's content\"), 'c'),\n \t\t{ OPTION_CALLBACK, 0, \"batch\", &batch, \"format\",\n \t\t\tN_(\"show info and content of objects fed from the standard input\"),\ndiff --git a/t/t8007-cat-file-textconv.sh b/t/t8007-cat-file-textconv.sh\nindex eacd49a..994c5b0 100755\n--- a/t/t8007-cat-file-textconv.sh\n+++ b/t/t8007-cat-file-textconv.sh\n@@ -24,6 +24,11 @@ bin: test version 2\n EOF\n \n test_expect_success 'no filter specified' '\n+\tgit cat-file -c :one.bin >result &&\n+\ttest_cmp expected result\n+'\n+\n+test_expect_success 'no filter specified' '\n \tgit cat-file --textconv :one.bin >result &&\n \ttest_cmp expected result\n '\n@@ -52,6 +57,11 @@ cat >expected <<EOF\n converted: test version 2\n EOF\n \n+test_expect_success 'cat-file -c on last commit' '\n+\tgit cat-file -c :one.bin >result &&\n+\ttest_cmp expected result\n+'\n+\n test_expect_success 'cat-file --textconv on last commit' '\n \tgit cat-file --textconv :one.bin >result &&\n \ttest_cmp expected result\n-- \n2.2.1.522.g2561c04.dirty\n"},{"id":"254516","messageId":"xmqqoaq7bmfp.fsf@gitster.dls.corp.google.com","threadId":"38323","inReplyTo":"1420793279-27853-1-git-send-email-kuleshovmail@gmail.com","subject":"Re: [PATCH] cat-file: add short option '-c' for 'cat-file --textconv'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-01-09T22:48:10Z","receivedAt":"2015-01-09T22:48:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexander Kuleshov <kuleshovmail@gmail.com> writes:\n\n> Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>\n> ---\n>  Documentation/git-cat-file.txt |  5 +++--\n>  builtin/cat-file.c             |  4 ++--\n>  t/t8007-cat-file-textconv.sh   | 10 ++++++++++\n>  3 files changed, 15 insertions(+), 4 deletions(-)\n>\n> diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt\n> index f6a16f4..b346a5d 100644\n> --- a/Documentation/git-cat-file.txt\n> +++ b/Documentation/git-cat-file.txt\n> @@ -9,14 +9,14 @@ git-cat-file - Provide content or type and size information for repository objec\n>  SYNOPSIS\n>  --------\n>  [verse]\n> -'git cat-file' (-t | -s | -e | -p | <type> | --textconv ) <object>\n> +'git cat-file' (-t | -s | -e | -p | <type> | (-c | --textconv) ) <object>\n\nDo we use \"-c\" for a shorthand for \"--textconv\" anywhere else?\n\nIs there any other command that has \"--textconv\" where \"-c\" does not\nmean \"--textconv\"?  Or worse yet, where \"-c\" already means something\ncompletely different from \"--textconv\"?\n\nUnlike end-user facing Porcelain commands, plumbing commands are\nprimarily meant to be used in scripts, and I am not sure how much\nbenefit we are getting by introducing new short options to them.\n\nAncient plumbing commands do have many single-letter options but\nthey were added back when more modern set of end-user facing\nPorcelain commands did not exist.\n"}]}