Skip to content

Commit 8fc9f02

Browse files
sunshinecogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3b30ba5 commit 8fc9f02

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

contrib/contacts/git-contacts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ if (@rev_args) {
181181
scan_rev_args(\%sources, \@rev_args)
182182
}
183183

184+
my $toplevel = `git rev-parse --show-toplevel`;
185+
chomp $toplevel;
186+
chdir($toplevel) or die "chdir failure: $toplevel: $!\n";
187+
184188
my %commits;
185189
blame_sources(\%sources, \%commits);
186190
import_commits(\%commits);

0 commit comments

Comments
 (0)