[PATCH] send-email: ignore files ending with ~
From: Alexandre Courbot <hidden>
Date: 2016-06-15 22:56:02
It certainly happened to a lot of people already: you carefully prepare your set of patches, export them using format-patch --cover-letter, write your cover letter, and send the set like this: $ git send-email --to=somerenowneddeveloper --to=myfutureemployer --cc=thismailinglistiwanttoimpress 00* And of course since you think you know what you are doing, you just answer 'a' at the first prompt to send all emails at once. The next day, all these people are laughing at you because the editor you used to write your cover letter saved a backup of the previous version and they received two versions of it, including one containing the familiar *** BLURB HERE *** (or potentially more humiliating stuff if you used the buffer as a temporary scratch). Let's save people's reputations by ignoring files ending with '~' in send-email. There should be no reason to send such a file anyways. Signed-off-by: Alexandre Courbot <redacted> --- git-send-email.perl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index be809e5..4cc5855 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl@@ -548,7 +548,10 @@ while (defined(my $f = shift @ARGV)) { sort readdir $dh; closedir $dh; } elsif ((-f $f or -p $f) and !check_file_rev_conflict($f)) { - push @files, $f; + # Ignore backup files + if ($f !~ "~\$") { + push @files, $f; + } } else { push @rev_list_opts, $f; }
--
1.8.1.1