Subject: [PATCH 2/3] git send-email: interpret unknown files as revision lists

From: Pierre Habouzit <[email-masked]>
Date: Fri, 31 Oct 2008 11:57:11 +0100

Instead of skipping unkown files on the command line, pass them through
git format-patch into a safe temporary directory. This allow no
complicated rev-list option lists combining "--all" "--not" and so on, but
allow to use ranges which are quite enough for most of the use cases.

Signed-off-by: Pierre Habouzit <[email-masked]>
---
 Documentation/git-send-email.txt |    2 +-
 git-send-email.perl              |    6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 82f5056..cafff1a 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -8,7 +8,7 @@ git-send-email - Send a collection of patches as emails
 
 SYNOPSIS
 --------
-'git send-email' [options] <file|directory> [... file|directory]
+'git send-email' [options] <file|directory|rev-list>...

 DESCRIPTION
diff --git a/git-send-email.perl b/git-send-email.perl
index 94ca5c8..0d50ee2 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -22,6 +22,7 @@ use Term::ReadLine;
 use Getopt::Long;
 use Data::Dumper;
 use Term::ANSIColor;
+use File::Temp qw/ tempdir /;
 use Git;
 
 package FakeTerm;
@@ -38,7 +39,7 @@ package main;
 
 sub usage {
 	print <<EOT;
-git send-email [options] <file | directory>...
+git send-email [options] <file | directory | rev-list >
 
   Composing:
     --from                  <str>  * Email From:
@@ -378,7 +379,8 @@ for my $f (@ARGV) {
 	} elsif (-f $f or -p $f) {
 		push @files, $f;
 	} else {
-		print STDERR "Skipping $f - not found.\n";
+		my $tempdir = tempdir(CLEANUP => 1);
+		push @files, $repo->command('format-patch', '-o', $tempdir, $f);
 	}
 }
 
-- 
1.6.0.3.759.g40a2.dirty