Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2013-07-21 14:52:40 +0400
committerJunio C Hamano <gitster@pobox.com>2013-07-22 02:13:42 +0400
commitccf6b45aff3f89016cf1a3e39a37e73e72c3e0f6 (patch)
treec0a9defa56a9648279471b70bf4b05192886aa2f /contrib/contacts
parent8e7c4a82ec25ee92bcb81de8bb8c4a27876d6edc (diff)
contrib: contacts: interpret committish akin to format-patch
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>
Diffstat (limited to 'contrib/contacts')
-rwxr-xr-xcontrib/contacts/git-contacts19
1 files changed, 18 insertions, 1 deletions
diff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts
index 1686ff340a..4553add0a6 100755
--- a/contrib/contacts/git-contacts
+++ b/contrib/contacts/git-contacts
@@ -102,9 +102,26 @@ sub scan_patch_file {
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) = @_;
- 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 = $_;