threads / patch / 24652

patchprune: allow --dry-run for -n and --verbose for -v

Subject: [PATCH] prune: allow --dry-run for -n and --verbose for -v

## tl;dr

4 messages between Aug 6, 2010 and Aug 7, 2010. Diffs are folded; open one to read it.

replies: 3people: 2as markdown or json

René Scharfe· Aug 6, 2010, 20:28 UTC · lore

For consistency with other git commands, let git prune accept the long options --dry-run and --verbose for the respective short ones -n and -v.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
 Documentation/git-prune.txt |    2 ++
 builtin/prune.c             |    5 ++---
 2 files changed, 4 insertions(+), 3 deletions(-)
Show changes to 2 files +4 −3

Documentation/git-prune.txt, builtin/prune.c

diff --git a/Documentation/git-prune.txt b/Documentation/git-prune.txt
index 15cfb7a..4d673a5 100644
--- a/Documentation/git-prune.txt
+++ b/Documentation/git-prune.txt
@@ -31,10 +31,12 @@ OPTIONS
 -------
 
 -n::
+--dry-run::
 	Do not remove anything; just report what it would
 	remove.
 
 -v::
+--verbose::
 	Report all removed objects.
 
 \--::
diff --git a/builtin/prune.c b/builtin/prune.c
index 81f915ec..99218ba 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -125,10 +125,9 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
 {
 	struct rev_info revs;
 	const struct option options[] = {
-		OPT_BOOLEAN('n', NULL, &show_only,
+		OPT_BOOLEAN('n', "dry-run", &show_only,
 			    "do not remove, show only"),
-		OPT_BOOLEAN('v', NULL, &verbose,
-			"report pruned objects"),
+		OPT_BOOLEAN('v', "verbose", &verbose, "report pruned objects"),
 		OPT_DATE(0, "expire", &expire,
 			 "expire objects older than <time>"),
 		OPT_END()
-- 
1.7.2
Jonathan Nieder· Aug 6, 2010, 21:04 UTC · re: René Scharfe · lore

Re: [PATCH] prune: allow --dry-run for -n and --verbose for -v

René Scharfe wrote:
Show 7 quoted lines
> +++ b/builtin/prune.c
> @@ -125,10 +125,9 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
>  {
>  	struct rev_info revs;
>  	const struct option options[] = {
> -		OPT_BOOLEAN('n', NULL, &show_only,
> +		OPT_BOOLEAN('n', "dry-run", &show_only,

For the curious: avoiding OPT__DRY_RUN allows us to give a better description:

>  			    "do not remove, show only"),
which makes sense to me.  Thanks.
René Scharfe· Aug 6, 2010, 21:41 UTC · re: Jonathan Nieder · lore

Re: [PATCH] prune: allow --dry-run for -n and --verbose for -v

Am 06.08.2010 23:04, schrieb Jonathan Nieder:
Show 16 quoted lines
> René Scharfe wrote:
>
>> +++ b/builtin/prune.c
>> @@ -125,10 +125,9 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
>>   {
>>   	struct rev_info revs;
>>   	const struct option options[] = {
>> -		OPT_BOOLEAN('n', NULL, &show_only,
>> +		OPT_BOOLEAN('n', "dry-run", &show_only,
>
> For the curious: avoiding OPT__DRY_RUN allows us to give a better
> description:
>
>>   			"do not remove, show only"),
>
> which makes sense to me.  Thanks.
Indeed.

Adding a helptext parameter to OPT__DRY_RUN à la OPT__COLOR would make it usable here as well as in commit.c and fetch.c. Similar changes could help OPT__VERBOSE and OPT__QUIET. Their standard helptexts don't add a lot of information..

René
René Scharfe· Aug 7, 2010, 08:25 UTC · re: René Scharfe · lore

Re: [PATCH] prune: allow --dry-run for -n and --verbose for -v

Am 06.08.2010 23:41, schrieb René Scharfe:
> Adding a helptext parameter to OPT__DRY_RUN à la OPT__COLOR would make
> it usable here as well as in commit.c and fetch.c.

Actually it doesn't, because the short option -n is used for other purposes there. But I still think it's worth doing because the description can then be made more meaningful instead while now it's just repeating the long option.

René

← back to recent threads