Skip to content

Commit

Permalink
contacts: fix to work in subdirectories
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Sunshine authored and Junio C Hamano committed Sep 18, 2013
1 parent 3b30ba5 commit 8fc9f02
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contrib/contacts/git-contacts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8fc9f02

Please sign in to comment.