threads / patch / 26003

patchgit-send-email: Accept -n as a synonym for --dry-run

Subject: [PATCH] git-send-email: Accept -n as a synonym for --dry-run

## tl;dr

9 messages between Dec 9, 2010 and Dec 13, 2010. Diffs are folded; open one to read it.

replies: 8people: 3as markdown or json

Alejandro R. Sedeño· Dec 9, 2010, 04:44 UTC · lore

git-send-email is not currently using -n for anything else, and it seems unlikely we will want to use it to mean anything else in the future, so add it as an alias for convenience.

Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
---
 git-send-email.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Show changes to git-send-email.perl +2 −2
diff --git a/git-send-email.perl b/git-send-email.perl
index 76565de..7e3df9a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -85,7 +85,7 @@ git send-email [options] <file | directory | rev-list options >
     --confirm               <str>  * Confirm recipients before sending;
                                      auto, cc, compose, always, or never.
     --quiet                        * Output one line of info per email.
-    --dry-run                      * Don't actually send the emails.
+    -n, --dry-run                  * Don't actually send the emails.
     --[no-]validate                * Perform patch sanity checks. Default on.
     --[no-]format-patch            * understand any non optional arguments as
                                      `git format-patch` ones.
@@ -304,7 +304,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "suppress-cc=s" => \@suppress_cc,
 		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
 		    "confirm=s" => \$confirm,
-		    "dry-run" => \$dry_run,
+		    "dry-run|n" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
 		    "validate!" => \$validate,
-- 
1.7.3.3
Alejandro R. Sedeño· Dec 9, 2010, 06:39 UTC · re: Alejandro R. Sedeño · lore

Re: [PATCH] git-send-email: Accept -n as a synonym for --dry-run

I noticed I forgot to make the corresponding documentation change. I'll include it in the next version of this patch, though I'm waiting to see if there's any other feedback first.

-Alejandro
Thomas Rast· Dec 9, 2010, 13:35 UTC · re: Alejandro R. Sedeño · lore

Re: [PATCH] git-send-email: Accept -n as a synonym for --dry-run

Alejandro R. Sedeño wrote:
Show 13 quoted lines
> diff --git a/git-send-email.perl b/git-send-email.perl
> index 76565de..7e3df9a 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -85,7 +85,7 @@ git send-email [options] <file | directory | rev-list options >
>      --confirm               <str>  * Confirm recipients before sending;
>                                       auto, cc, compose, always, or never.
>      --quiet                        * Output one line of info per email.
> -    --dry-run                      * Don't actually send the emails.
> +    -n, --dry-run                  * Don't actually send the emails.
>      --[no-]validate                * Perform patch sanity checks. Default on.
>      --[no-]format-patch            * understand any non optional arguments as
>                                       `git format-patch` ones.

Good change by itself, but this is the first short option for git-send-email. Maybe --force should also get its analogous -f alias? Any others?

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Alejandro R. Sedeño· Dec 9, 2010, 16:21 UTC · re: Thomas Rast · lore

Re: [PATCH] git-send-email: Accept -n as a synonym for --dry-run

On 12/09/2010 08:35 AM, Thomas Rast wrote:
Show 18 quoted lines
> Alejandro R. Sedeño wrote:
>> diff --git a/git-send-email.perl b/git-send-email.perl
>> index 76565de..7e3df9a 100755
>> --- a/git-send-email.perl
>> +++ b/git-send-email.perl
>> @@ -85,7 +85,7 @@ git send-email [options] <file | directory | rev-list options >
>>      --confirm               <str>  * Confirm recipients before sending;
>>                                       auto, cc, compose, always, or never.
>>      --quiet                        * Output one line of info per email.
>> -    --dry-run                      * Don't actually send the emails.
>> +    -n, --dry-run                  * Don't actually send the emails.
>>      --[no-]validate                * Perform patch sanity checks. Default on.
>>      --[no-]format-patch            * understand any non optional arguments as
>>                                       `git format-patch` ones.
> 
> Good change by itself, but this is the first short option for
> git-send-email.  Maybe --force should also get its analogous -f alias?
> Any others?

Sounds good to me, though I notice that --force isn't in git-send-email's documentation at all.

If we're expanding this patch[set] to include other short options, -q for --quiet makes sense to me as well.

Other suggestions?
-Alejandro
Alejandro R. Sedeño· Dec 10, 2010, 18:44 UTC · re: Alejandro R. Sedeño · lore

git-send-email: add some short options and update documentation

Add short options that were mentioned in the thread to git-send-email, specifically:

-n for --dry-run -f for --force -q for --quiet

Since --force didn't have documentation in Documentation/git-send-email.txt, a separate commit adds some first.

[PATCH 1/2] Add --force to git-send-email documentation [PATCH 2/2] git-send-email: Add some short options

Documentation/git-send-email.txt | 6 ++++++ git-send-email.perl | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-)

Alejandro R. Sedeño· Dec 13, 2010, 20:12 UTC · re: Alejandro R. Sedeño · lore

Re: git-send-email: add some short options and update documentation

On 12/10/2010 01:44 PM, Alejandro R. Sedeño wrote:
Show 12 quoted lines
> Add short options that were mentioned in the thread to git-send-email,
> specifically:
> 
> -n for --dry-run
> -f for --force
> -q for --quiet
> 
> Since --force didn't have documentation in
> Documentation/git-send-email.txt, a separate commit adds some
> first.
> 
> [PATCH 1/2] Add --force to git-send-email documentation
I see this has been pulled into master. Thanks, Junio.
> [PATCH 2/2] git-send-email: Add some short options
Any more comments on this?
-Alejandro
Junio C Hamano· Dec 13, 2010, 21:47 UTC · re: Alejandro R. Sedeño · lore

Re: git-send-email: add some short options and update documentation

"Alejandro R. Sedeño" <asedeno@mit.edu> writes:
>> [PATCH 2/2] git-send-email: Add some short options
>
> Any more comments on this?
Not from me, other than that I am not overly interested myself.
Alejandro R. Sedeño· Dec 10, 2010, 18:44 UTC · re: Alejandro R. Sedeño · lore

[PATCH 1/2] Add --force to git-send-email documentation

Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
---
 Documentation/git-send-email.txt |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Show changes to Documentation/git-send-email.txt +3 −0
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index ebc024a..7ec9dab 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -322,6 +322,9 @@ have been specified, in which case default to 'compose'.
 Default is the value of 'sendemail.validate'; if this is not set,
 default to '--validate'.
 
+--force::
+	Send emails even if safety checks would prevent it.
+
 
 CONFIGURATION
 -------------
-- 
1.7.3.3
Alejandro R. Sedeño· Dec 10, 2010, 18:44 UTC · re: Alejandro R. Sedeño · lore

[PATCH 2/2] git-send-email: Add some short options

* Accept -n as a synonym for --dry-run
* Accept -f as a synonym for --force
* Accept -q as a synonym for --quiet
Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
---
 Documentation/git-send-email.txt |    3 +++
 git-send-email.perl              |   12 ++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)
Show changes to 2 files +9 −6

Documentation/git-send-email.txt, git-send-email.perl

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 7ec9dab..2d0faf2 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -297,6 +297,7 @@ Default is the value of 'sendemail.confirm' configuration value; if that
 is unspecified, default to 'auto' unless any of the suppress options
 have been specified, in which case default to 'compose'.
 
+-n::
 --dry-run::
 	Do everything except actually send the emails.
 
@@ -306,6 +307,7 @@ have been specified, in which case default to 'compose'.
 	or as a file name ('--no-format-patch'). By default, when such a conflict
 	occurs, git send-email will fail.
 
+-q::
 --quiet::
 	Make git-send-email less verbose.  One line per email should be
 	all that is output.
@@ -322,6 +324,7 @@ have been specified, in which case default to 'compose'.
 Default is the value of 'sendemail.validate'; if this is not set,
 default to '--validate'.
 
+-f::
 --force::
 	Send emails even if safety checks would prevent it.
 
diff --git a/git-send-email.perl b/git-send-email.perl
index 76565de..ede7835 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -84,12 +84,12 @@ git send-email [options] <file | directory | rev-list options >
   Administering:
     --confirm               <str>  * Confirm recipients before sending;
                                      auto, cc, compose, always, or never.
-    --quiet                        * Output one line of info per email.
-    --dry-run                      * Don't actually send the emails.
+    -q, --quiet                    * Output one line of info per email.
+    -n, --dry-run                  * Don't actually send the emails.
     --[no-]validate                * Perform patch sanity checks. Default on.
     --[no-]format-patch            * understand any non optional arguments as
                                      `git format-patch` ones.
-    --force                        * Send even if safety checks would prevent it.
+    -f, --force                    * Send even if safety checks would prevent it.
 
 EOT
 	exit(1);
@@ -298,19 +298,19 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "identity=s" => \$identity,
 		    "annotate" => \$annotate,
 		    "compose" => \$compose,
-		    "quiet" => \$quiet,
+		    "quiet|q" => \$quiet,
 		    "cc-cmd=s" => \$cc_cmd,
 		    "suppress-from!" => \$suppress_from,
 		    "suppress-cc=s" => \@suppress_cc,
 		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
 		    "confirm=s" => \$confirm,
-		    "dry-run" => \$dry_run,
+		    "dry-run|n" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
 		    "validate!" => \$validate,
 		    "format-patch!" => \$format_patch,
 		    "8bit-encoding=s" => \$auto_8bit_encoding,
-		    "force" => \$force,
+		    "force|f" => \$force,
 	 );
 
 unless ($rc) {
-- 
1.7.3.3

← back to recent threads