git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] contacts: allow execution from other directories
@ 2013-09-17 12:50 Thomas Gummerer
  2013-09-17 16:44 ` Eric Sunshine
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Gummerer @ 2013-09-17 12:50 UTC (permalink / raw)
  To: git; +Cc: Thomas Gummerer, Junio C Hamano, Eric Sunshine

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] contacts: allow execution from other directories
  2013-09-17 12:50 [PATCH] contacts: allow execution from other directories Thomas Gummerer
@ 2013-09-17 16:44 ` Eric Sunshine
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Sunshine @ 2013-09-17 16:44 UTC (permalink / raw)
  To: Thomas Gummerer; +Cc: Git List, Junio C Hamano

On Tue, Sep 17, 2013 at 8:50 AM, Thomas Gummerer <t.gummerer@gmail.com> wrote:
> 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.

Thanks. This was on my to-do list but fell off my radar when I
accidentally deleted the to-do list (which, oddly, was not under
version control).

I have a patch in my local tree accomplishing the same thing, but in a
less expensive manner. I'll post it a bit later today for review.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-09-17 16:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-17 12:50 [PATCH] contacts: allow execution from other directories Thomas Gummerer
2013-09-17 16:44 ` Eric Sunshine

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).