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 <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Eric Sunshine committed
Sep 17, 2013 at 22:52 UTC
8fc9f0227e8ea0461abfd3dc01cf1a51cca0f87f
1 file changed
+4
contrib/contacts/git-contacts
+4
@@ -181,6 +181,10 @@ if (@rev_args) {
181
scan_rev_args(\%sources, \@rev_args)
182
}
183
184
+my $toplevel = `git rev-parse --show-toplevel`;
185
+chomp $toplevel;
186
+chdir($toplevel) or die "chdir failure: $toplevel: $!\n";
187
+
188
my %commits;
189
blame_sources(\%sources, \%commits);
190
import_commits(\%commits);