git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gummerer <t.gummerer@gmail.com>
To: git@vger.kernel.org
Cc: Thomas Gummerer <t.gummerer@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	Eric Sunshine <sunshine@sunshineco.com>
Subject: [PATCH] contacts: allow execution from other directories
Date: Tue, 17 Sep 2013 14:50:46 +0200	[thread overview]
Message-ID: <1379422246-12818-1-git-send-email-t.gummerer@gmail.com> (raw)

Currently git-contacts only works if it is executed from the top level
of the git repository.  Enable the execution in sub directories of that
repository.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
---

I have no experience in perl, so there may be nicer implementations.  It works when tested manually.

 contrib/contacts/git-contacts | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts
index fb6429b..32f03fc 100755
--- a/contrib/contacts/git-contacts
+++ b/contrib/contacts/git-contacts
@@ -61,6 +61,9 @@ sub import_commits {
 sub get_blame {
 	my ($commits, $source, $from, $ranges) = @_;
 	return unless @$ranges;
+	my $git_dir = `git rev-parse --show-toplevel`;
+	chomp($git_dir);
+	$source = $git_dir . '/' . $source;
 	open my $f, '-|',
 		qw(git blame --porcelain -C),
 		map({"-L$_->[0],+$_->[1]"} @$ranges),
-- 
1.8.4.535.g7b94f8e.dirty

             reply	other threads:[~2013-09-17 12:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-17 12:50 Thomas Gummerer [this message]
2013-09-17 16:44 ` [PATCH] contacts: allow execution from other directories Eric Sunshine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1379422246-12818-1-git-send-email-t.gummerer@gmail.com \
    --to=t.gummerer@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).