From: Eric Sunshine Date: Wed, 18 Sep 2013 02:52:05 +0000 (-0400) Subject: contacts: fix to work in subdirectories X-Git-Tag: v1.8.5-rc0~83^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/8fc9f0227e8ea0461abfd3dc01cf1a51cca0f87f?ds=inline;hp=--cc contacts: fix to work in subdirectories Unlike other git commands which work correctly at the top-level or in a subdirectory, git-contacts fails when invoked in a subdirectory. This is because it invokes git-blame with pathnames relative to the top-level, but git-blame interprets the pathnames as relative to the current directory. Fix this. Signed-off-by: Eric Sunshine Signed-off-by: Junio C Hamano --- 8fc9f0227e8ea0461abfd3dc01cf1a51cca0f87f diff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts index fb6429b64b..428cc1a9a1 100755 --- a/contrib/contacts/git-contacts +++ b/contrib/contacts/git-contacts @@ -181,6 +181,10 @@ if (@rev_args) { scan_rev_args(\%sources, \@rev_args) } +my $toplevel = `git rev-parse --show-toplevel`; +chomp $toplevel; +chdir($toplevel) or die "chdir failure: $toplevel: $!\n"; + my %commits; blame_sources(\%sources, \%commits); import_commits(\%commits);