git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] send-email: ignore files ending with ~

From
ACAlexandre Courbot <gnurou@gmail.com>
Date
Feb 3, 2013, 14:55 UTC
Message-ID
<1359903340-14508-1-git-send-email-gnurou@gmail.com>

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 <gnurou@gmail.com>
---
 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
Next: Antoine Pelisse
Message 1 of 3 in “send-email: ignore files ending with ~”
  1. send-email: ignore files ending with ~Alexandre Courbot, Feb 3, 2013
  2. Antoine PelisseFeb 3, 2013
  3. Alexandre CourbotFeb 4, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.