git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] contacts: allow execution from other directories

From
Thomas Gummerer <t.gummerer@gmail.com>
Date
Sep 17, 2013, 12:50 UTC
Message-ID
<1379422246-12818-1-git-send-email-t.gummerer@gmail.com>

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
Next: Eric Sunshine
Message 1 of 2 in “contacts: allow execution from other directories”
  1. contacts: allow execution from other directoriesThomas Gummerer, Sep 17, 2013
  2. Eric SunshineSep 17, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.