[PATCH] contacts: allow execution from other directories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---

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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]