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

4 messages from 2010-08-06 to 2010-08-07. Participants: René Scharfe, Jonathan Nieder.
Thread: https://gitlist.dev/t/24652

## René Scharfe, 2010-08-06 20:28

Subject: [PATCH] prune: allow --dry-run for -n and --verbose for -v
Message-ID: <4C5C7055.3090100@lsrfire.ath.cx>
URL: https://gitlist.dev/e/4C5C7055.3090100%40lsrfire.ath.cx

```
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(-)

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, 2010-08-06 21:04

Subject: Re: [PATCH] prune: allow --dry-run for -n and --verbose for -v
Message-ID: <20100806210429.GA6495@burratino>
URL: https://gitlist.dev/e/20100806210429.GA6495%40burratino
In-Reply-To: <4C5C7055.3090100@lsrfire.ath.cx>

```
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.

```

## René Scharfe, 2010-08-06 21:41

Subject: Re: [PATCH] prune: allow --dry-run for -n and --verbose for -v
Message-ID: <4C5C8193.1040608@lsrfire.ath.cx>
URL: https://gitlist.dev/e/4C5C8193.1040608%40lsrfire.ath.cx
In-Reply-To: <20100806210429.GA6495@burratino>

```
Am 06.08.2010 23:04, schrieb Jonathan Nieder:
> 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, 2010-08-07 08:25

Subject: Re: [PATCH] prune: allow --dry-run for -n and --verbose for -v
Message-ID: <4C5D1897.2070109@lsrfire.ath.cx>
URL: https://gitlist.dev/e/4C5D1897.2070109%40lsrfire.ath.cx
In-Reply-To: <4C5C8193.1040608@lsrfire.ath.cx>

```
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é

```
