Skip to contentSkip to conversation

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

PATCH In review René Scharfe 2 participants 4 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 prune: allow --dry-run for -n and --verbose for -v

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.

---
 Documentation/git-prune.txt |    2 ++
 builtin/prune.c             |    5 ++---
 2 files changed, 4 insertions(+), 3 deletions(-)
Documentation/git-prune.txt +2 -0
index 15cfb7a..4d673a5 100644
@@ -31,10 +31,12 @@ OPTIONS
 -------
 
 -n::
+--dry-run::
 	Do not remove anything; just report what it would
 	remove.
 
 -v::
+--verbose::
 	Report all removed objects.
 
 \--::
builtin/prune.c +2 -3
index 81f915ec..99218ba 100644
@@ -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()
Signature · 1 line
1.7.2
#1 lore raw

builtin/prune.c int cmd_prune(int argc, const char **argv, const char *prefix) · line 128

Quoted 7 lines · René Scharfe

+++ b/builtin/prune.c

builtin/prune.c +1 -1
@@ -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:

builtin/prune.c int cmd_prune(int argc, const char **argv, const char *prefix) · line 129

Quoted 1 line
builtin/prune.c +0 -0
 			    "do not remove, show only"),

which makes sense to me. Thanks.

#2 lore raw

Am 06.08.2010 23:04, schrieb Jonathan Nieder:

Quoted 13 lines

builtin/prune.c int cmd_prune(int argc, const char **argv, const char *prefix) · line 128

Quoted 7 lines · René Scharfe

+++ b/builtin/prune.c

builtin/prune.c +1 -1
@@ -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:

Quoted 3 lines

builtin/prune.c int cmd_prune(int argc, const char **argv, const char *prefix) · line 129

Quoted 1 line
builtin/prune.c +0 -0
  			"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é

#3 lore raw

Am 06.08.2010 23:41, schrieb René Scharfe:

Quoted 2 lines

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é