# [PATCH] git-send-email: Do not send editor backup files in a directory

3 messages from 2011-07-22 to 2011-07-29. Participants: Joe Perches, Ramkumar Ramachandra.
Thread: https://gitlist.dev/t/27884

## Joe Perches, 2011-07-22 07:29

Subject: [PATCH] git-send-email: Do not send editor backup files in a directory
Message-ID: <865ddd502d9ba4a19c33c69039ecb70ea12c0692.1311319658.git.joe@perches.com>
URL: https://gitlist.dev/e/865ddd502d9ba4a19c33c69039ecb70ea12c0692.1311319658.git.joe%40perches.com

```
Sift out backup files that are commonly created by editors.

Signed-off-by: Joe Perches <joe@perches.com>
---
 git-send-email.perl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 98ab33a..a4558d9 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -521,7 +521,9 @@ while (defined(my $f = shift @ARGV)) {
 		opendir my $dh, $f
 			or die "Failed to opendir $f: $!";
 
-		push @files, grep { -f $_ } map { catfile($f, $_) }
+		push @files, grep { !/#.+#$/ && !/~$/ &&
+					!/\.bak$/ && !/\.orig$/ &&
+					-f $_ } map { catfile($f, $_) }
 				sort readdir $dh;
 		closedir $dh;
 	} elsif ((-f $f or -p $f) and !check_file_rev_conflict($f)) {
-- 
1.7.6.131.g99019

```

## Joe Perches, 2011-07-29 00:41

Subject: Re: [PATCH] git-send-email: Do not send editor backup files in a directory
Message-ID: <loom.20110729T023925-64@post.gmane.org>
URL: https://gitlist.dev/e/loom.20110729T023925-64%40post.gmane.org
In-Reply-To: <865ddd502d9ba4a19c33c69039ecb70ea12c0692.1311319658.git.joe@perches.com>

```
Joe Perches <joe <at> perches.com> writes:
> Sift out backup files that are commonly created by editors.

Ping?

-------------- 
diff --git a/git-send-email.perl b/git-send-email.perl
[]
@@ -521,7 +521,9 @@ while (defined(my $f = shift @ARGV)) {
[]
-		push @files, grep { -f $_ } map { catfile($f, $_) }
+		push @files, grep { !/#.+#$/ && !/~$/ &&
+					!/\.bak$/ && !/\.orig$/ &&
+					-f $_ } map { catfile($f, $_) }

```

## Ramkumar Ramachandra, 2011-07-29 06:47

Subject: Re: [PATCH] git-send-email: Do not send editor backup files in a directory
Message-ID: <CALkWK0nowSnmN7gj6+_VDX81njev-q6WUgpaFouRHMzJCva9Rw@mail.gmail.com>
URL: https://gitlist.dev/e/CALkWK0nowSnmN7gj6%2B_VDX81njev-q6WUgpaFouRHMzJCva9Rw%40mail.gmail.com
In-Reply-To: <865ddd502d9ba4a19c33c69039ecb70ea12c0692.1311319658.git.joe@perches.com>

```
Hi Joe,

Joe Perches writes
> [Subject: git-send-email: Do not send editor backup files in a directory]

I like this change.  I don't have to resort to my normal `git
send-email outgoing/*.patch` anymore.

Thanks.

-- Ram

```
