{"thread":{"id":"34947","subject":"[PATCH] contacts: allow execution from other directories","startedAt":"2013-09-17T12:50:46Z","lastAt":"2013-09-17T16:44:02Z","messageCount":2,"participants":["Thomas Gummerer","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"227749","messageId":"1379422246-12818-1-git-send-email-t.gummerer@gmail.com","threadId":"34947","inReplyTo":null,"subject":"[PATCH] contacts: allow execution from other directories","fromName":"Thomas Gummerer","fromEmail":"t.gummerer@gmail.com","sentAt":"2013-09-17T12:50:46Z","receivedAt":"2013-09-17T12:50:46Z","isPatch":true,"sender":{"key":"t.gummerer@gmail.com","avatar":"https://avatars.githubusercontent.com/u/191004?v=4"},"body":"Currently git-contacts only works if it is executed from the top level\nof the git repository.  Enable the execution in sub directories of that\nrepository.\n\nSigned-off-by: Thomas Gummerer <t.gummerer@gmail.com>\n---\n\nI have no experience in perl, so there may be nicer implementations.  It works when tested manually.\n\n contrib/contacts/git-contacts | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts\nindex fb6429b..32f03fc 100755\n--- a/contrib/contacts/git-contacts\n+++ b/contrib/contacts/git-contacts\n@@ -61,6 +61,9 @@ sub import_commits {\n sub get_blame {\n \tmy ($commits, $source, $from, $ranges) = @_;\n \treturn unless @$ranges;\n+\tmy $git_dir = `git rev-parse --show-toplevel`;\n+\tchomp($git_dir);\n+\t$source = $git_dir . '/' . $source;\n \topen my $f, '-|',\n \t\tqw(git blame --porcelain -C),\n \t\tmap({\"-L$_->[0],+$_->[1]\"} @$ranges),\n-- \n1.8.4.535.g7b94f8e.dirty\n"},{"id":"227760","messageId":"CAPig+cTgfE_Lo2B50fy6rYOmfmb2O9wOZZfasTwt_Lx0k2KOOw@mail.gmail.com","threadId":"34947","inReplyTo":"1379422246-12818-1-git-send-email-t.gummerer@gmail.com","subject":"Re: [PATCH] contacts: allow execution from other directories","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-09-17T16:44:02Z","receivedAt":"2013-09-17T16:44:02Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Sep 17, 2013 at 8:50 AM, Thomas Gummerer <t.gummerer@gmail.com> wrote:\n> Currently git-contacts only works if it is executed from the top level\n> of the git repository.  Enable the execution in sub directories of that\n> repository.\n\nThanks. This was on my to-do list but fell off my radar when I\naccidentally deleted the to-do list (which, oddly, was not under\nversion control).\n\nI have a patch in my local tree accomplishing the same thing, but in a\nless expensive manner. I'll post it a bit later today for review.\n\n> Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>\n> ---\n>\n> I have no experience in perl, so there may be nicer implementations.  It works when tested manually.\n>\n>  contrib/contacts/git-contacts | 3 +++\n>  1 file changed, 3 insertions(+)\n>\n> diff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts\n> index fb6429b..32f03fc 100755\n> --- a/contrib/contacts/git-contacts\n> +++ b/contrib/contacts/git-contacts\n> @@ -61,6 +61,9 @@ sub import_commits {\n>  sub get_blame {\n>         my ($commits, $source, $from, $ranges) = @_;\n>         return unless @$ranges;\n> +       my $git_dir = `git rev-parse --show-toplevel`;\n> +       chomp($git_dir);\n> +       $source = $git_dir . '/' . $source;\n>         open my $f, '-|',\n>                 qw(git blame --porcelain -C),\n>                 map({\"-L$_->[0],+$_->[1]\"} @$ranges),\n> --\n> 1.8.4.535.g7b94f8e.dirty\n>\n"}]}