Committishes can be mentioned along with patch files in the same
invocation. For example:

  % git contacts master..feature extra/*.patch

Signed-off-by: Eric Sunshine <sunsh...@sunshineco.com>
---
 contrib/contacts/git-contacts | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts
index ab11670..abb90a1 100755
--- a/contrib/contacts/git-contacts
+++ b/contrib/contacts/git-contacts
@@ -3,7 +3,7 @@
 # List people who might be interested in a patch.  Useful as the argument to
 # git-send-email --cc-cmd option, and in other situations.
 #
-# Usage: git contacts <file> ...
+# Usage: git contacts <file | rev-list option> ...
 
 use strict;
 use warnings;
@@ -104,8 +104,32 @@ sub commits_from_patch {
        close $f;
 }
 
+sub commits_from_rev_args {
+       my ($commits, $args) = @_;
+       open my $f, '-|', qw(git rev-list --reverse), @$args or die;
+       while (<$f>) {
+               chomp;
+               my $id = $_;
+               $seen{$id} = 1;
+               open my $g, '-|', qw(git show -C --oneline), $id or die;
+               scan_hunks($commits, $id, $g);
+               close $g;
+       }
+       close $f;
+}
+
+my (@files, @rev_args);
+for (@ARGV) {
+       if (-e) {
+               push @files, $_;
+       } else {
+               push @rev_args, $_;
+       }
+}
+
 my %commits;
-commits_from_patch(\%commits, $_) for (@ARGV);
+commits_from_patch(\%commits, $_) for (@files);
+commits_from_rev_args(\%commits, \@rev_args) if @rev_args;
 import_commits(\%commits);
 
 my %count_per_person;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to