Skip to content

Commit d193390

Browse files
committed
Allow running the script from any subdirectory
The script assumes it is running from the root of the repository. This change allows using the script from any subdirectory as well.
1 parent 44e119a commit d193390

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

git-diff-blame

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ sub get_blame_prefix {
1515
return $1;
1616
}
1717

18+
$git_root = `git rev-parse --show-toplevel`;
19+
$git_root =~ s/^\s+//;
20+
$git_root =~ s/\s+$//;
21+
chdir($git_root) or die "$!";
22+
1823
my ($oldrev, $newrev) = @ARGV;
1924
$oldrev ||= 'HEAD';
2025
if ($newrev) {

0 commit comments

Comments
 (0)