Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
contrib: contacts: interpret committish akin to format-patch
author
Eric Sunshine
<sunshine@sunshineco.com>
Sun, 21 Jul 2013 10:52:40 +0000
(06:52 -0400)
committer
Junio C Hamano
<gitster@pobox.com>
Sun, 21 Jul 2013 22:13:42 +0000
(15:13 -0700)
As a convenience, accept the same style <since> committish as accepted
by git-format-patch. For example:
% git contacts origin
will consider commits in the current branch built atop 'origin', just as
"git format-patch origin" will format commits built atop 'origin'.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/contacts/git-contacts
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
8e7c4a8
)
diff --git
a/contrib/contacts/git-contacts
b/contrib/contacts/git-contacts
index 1686ff340ad0dbc7eff53411107858a08f4024b9..4553add0a6e0a7619b1c6b092d02bea126a14e0b 100755
(executable)
--- a/
contrib/contacts/git-contacts
+++ b/
contrib/contacts/git-contacts
@@
-102,9
+102,26
@@
sub scan_patch_file {
close $f;
}
close $f;
}
+sub parse_rev_args {
+ my @args = @_;
+ open my $f, '-|',
+ qw(git rev-parse --revs-only --default HEAD --symbolic), @args
+ or die;
+ my @revs;
+ while (<$f>) {
+ chomp;
+ push @revs, $_;
+ }
+ close $f;
+ return @revs if scalar(@revs) != 1;
+ return "^$revs[0]", 'HEAD' unless $revs[0] =~ /^-/;
+ return $revs[0], 'HEAD';
+}
+
sub scan_rev_args {
my ($commits, $args) = @_;
sub scan_rev_args {
my ($commits, $args) = @_;
- open my $f, '-|', qw(git rev-list --reverse), @$args or die;
+ my @revs = parse_rev_args(@$args);
+ open my $f, '-|', qw(git rev-list --reverse), @revs or die;
while (<$f>) {
chomp;
my $id = $_;
while (<$f>) {
chomp;
my $id = $_;