# [PATCH] contacts: introduce --since and --min-percent

4 messages from 2015-01-16 to 2015-01-21. Participants: Ramkumar Ramachandra, Eric Sunshine.
Thread: https://gitlist.dev/t/38386

## Ramkumar Ramachandra, 2015-01-16 20:58

Subject: [PATCH] contacts: introduce --since and --min-percent
Message-ID: <1421441933-54183-1-git-send-email-artagnon@gmail.com>
URL: https://gitlist.dev/e/1421441933-54183-1-git-send-email-artagnon%40gmail.com

```
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 contrib/contacts/git-contacts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts
index dbe2abf..b06f2e1 100755
--- a/contrib/contacts/git-contacts
+++ b/contrib/contacts/git-contacts
@@ -8,12 +8,16 @@
 use strict;
 use warnings;
 use IPC::Open2;
+use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;
 
 my $since = '5-years-ago';
 my $min_percent = 10;
 my $labels_rx = qr/Signed-off-by|Reviewed-by|Acked-by|Cc/i;
 my %seen;
 
+my $rv = GetOptions('since=s' => \$since, 'min-percent=i' => \$min_percent);
+exit 1 if (!$rv);
+
 sub format_contact {
 	my ($name, $email) = @_;
 	return "$name <$email>";
-- 
2.2.1

```

## Eric Sunshine, 2015-01-16 21:11

Subject: Re: [PATCH] contacts: introduce --since and --min-percent
Message-ID: <CAPig+cS5is73damiYgCmWp3QzmBX+E38f26oyn2nwG0FO2AStQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcS5is73damiYgCmWp3QzmBX%2BE38f26oyn2nwG0FO2AStQ%40mail.gmail.com
In-Reply-To: <1421441933-54183-1-git-send-email-artagnon@gmail.com>

```
On Fri, Jan 16, 2015 at 3:58 PM, Ramkumar Ramachandra
<artagnon@gmail.com> wrote:
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
> diff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts
> index dbe2abf..b06f2e1 100755
> --- a/contrib/contacts/git-contacts
> +++ b/contrib/contacts/git-contacts
> @@ -8,12 +8,16 @@
>  use strict;
>  use warnings;
>  use IPC::Open2;
> +use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;

Most of the rest of the codebase uses qw(...) rather than qw/.../.

>  my $since = '5-years-ago';
>  my $min_percent = 10;
>  my $labels_rx = qr/Signed-off-by|Reviewed-by|Acked-by|Cc/i;
>  my %seen;
>
> +my $rv = GetOptions('since=s' => \$since, 'min-percent=i' => \$min_percent);
> +exit 1 if (!$rv);

This would make more sense if moved down to the point where the script
arguments are processed (just before the 'if (!@ARGV)' line, for
instance).

These new options should be documented in git-contacts.txt. Also, the
"Limitations" section of the documentation says that these values are
currently hard-coded, so it deserves an update as well.

>  sub format_contact {
>         my ($name, $email) = @_;
>         return "$name <$email>";
> --
> 2.2.1

```

## Ramkumar Ramachandra, 2015-01-16 21:23

Subject: [PATCH v2] contacts: introduce --since and --min-percent
Message-ID: <1421443439-54809-1-git-send-email-artagnon@gmail.com>
URL: https://gitlist.dev/e/1421443439-54809-1-git-send-email-artagnon%40gmail.com
In-Reply-To: <1421441933-54183-1-git-send-email-artagnon@gmail.com>

```
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 contrib/contacts/git-contacts     |  4 ++++
 contrib/contacts/git-contacts.txt | 16 ++++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts
index dbe2abf..5dde920 100755
--- a/contrib/contacts/git-contacts
+++ b/contrib/contacts/git-contacts
@@ -8,6 +8,7 @@
 use strict;
 use warnings;
 use IPC::Open2;
+use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
 
 my $since = '5-years-ago';
 my $min_percent = 10;
@@ -158,6 +159,9 @@ sub mailmap_contacts {
 	return \%mapped;
 }
 
+my $rv = GetOptions('since=s' => \$since, 'min-percent=i' => \$min_percent);
+exit 1 if (!$rv);
+
 if (!@ARGV) {
 	die "No input revisions or patch files\n";
 }
diff --git a/contrib/contacts/git-contacts.txt b/contrib/contacts/git-contacts.txt
index dd914d1..a50c97f 100644
--- a/contrib/contacts/git-contacts.txt
+++ b/contrib/contacts/git-contacts.txt
@@ -31,6 +31,16 @@ discuss proposed changes, or for finding the list of recipients to Cc: when
 submitting a patch series via `git send-email`. For the latter case, `git
 contacts` can be used as the argument to `git send-email`'s `--cc-cmd` option.
 
+OPTIONS
+-------
+
+--min-percent::
+	The minimum threshold of blame percentage that a person must
+	exceed in order to be reported.
+
+--since::
+        Depth of history to dig.
+
 
 DISCUSSION
 ----------
@@ -83,10 +93,8 @@ $ git send-email --cc-cmd='git contacts' feature/*.patch
 LIMITATIONS
 -----------
 
-Several conditions controlling a person's significance are currently
-hard-coded, such as minimum participation level (10%), blame date-limiting (5
-years), and `-C` level for detecting moved and copied lines (a single `-C`). In
-the future, these conditions may become configurable.
+The `-C` level for detecting moved and copied lines (a single `-C`) is
+hard-coded. In the future, this may become configurable.
 
 
 GIT
-- 
2.2.1

```

## Ramkumar Ramachandra, 2015-01-21 17:09

Subject: Re: [PATCH v2] contacts: introduce --since and --min-percent
Message-ID: <CALkWK0kE4AOgwN7+U5tqH8PLioMy6yXrcH-XiEpDEDZ4RfT4CQ@mail.gmail.com>
URL: https://gitlist.dev/e/CALkWK0kE4AOgwN7%2BU5tqH8PLioMy6yXrcH-XiEpDEDZ4RfT4CQ%40mail.gmail.com
In-Reply-To: <1421443439-54809-1-git-send-email-artagnon@gmail.com>

```
Ramkumar Ramachandra wrote:
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>

Junio: this isn't in the latest rebuild of pu; I wonder if you've
forgotten to pick it up.

```
