git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cat-file: add short option '-c' for 'cat-file --textconv'
@ 2015-01-09  8:47 Alexander Kuleshov
  2015-01-09 22:48 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kuleshov @ 2015-01-09  8:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Alexander Kuleshov

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cat-file: add short option '-c' for 'cat-file --textconv'
  2015-01-09  8:47 [PATCH] cat-file: add short option '-c' for 'cat-file --textconv' Alexander Kuleshov
@ 2015-01-09 22:48 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2015-01-09 22:48 UTC (permalink / raw)
  To: Alexander Kuleshov; +Cc: git

Alexander Kuleshov <kuleshovmail@gmail.com> writes:

> Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
> ---
>  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>

Do we use "-c" for a shorthand for "--textconv" anywhere else?

Is there any other command that has "--textconv" where "-c" does not
mean "--textconv"?  Or worse yet, where "-c" already means something
completely different from "--textconv"?

Unlike end-user facing Porcelain commands, plumbing commands are
primarily meant to be used in scripts, and I am not sure how much
benefit we are getting by introducing new short options to them.

Ancient plumbing commands do have many single-letter options but
they were added back when more modern set of end-user facing
Porcelain commands did not exist.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-09 22:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-09  8:47 [PATCH] cat-file: add short option '-c' for 'cat-file --textconv' Alexander Kuleshov
2015-01-09 22:48 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).