Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when running #7

Open
ericfreese opened this issue Jan 26, 2017 · 1 comment
Open

Errors when running #7

ericfreese opened this issue Jan 26, 2017 · 1 comment

Comments

@ericfreese
Copy link

Hi, I'm getting some errors trying to run git diff-blame

Use of uninitialized value $prefilename in regexp compilation at /Users/ericfreese/bin/git-diff-blame line 54, <$diff> line 1.
Use of uninitialized value $postfilename in regexp compilation at /Users/ericfreese/bin/git-diff-blame line 57, <$diff> line 1.
Use of uninitialized value $prefilename in regexp compilation at /Users/ericfreese/bin/git-diff-blame line 54, <$diff> line 2.
Use of uninitialized value $postfilename in regexp compilation at /Users/ericfreese/bin/git-diff-blame line 57, <$diff> line 2.
Use of uninitialized value $prefilename in regexp compilation at /Users/ericfreese/bin/git-diff-blame line 54, <$diff> line 3.
Use of uninitialized value $postfilename in regexp compilation at /Users/ericfreese/bin/git-diff-blame line 57, <$diff> line 3.
Use of uninitialized value $prefilename in regexp compilation at /Users/ericfreese/bin/git-diff-blame line 54, <$diff> line 4.
Use of uninitialized value $postfilename in regexp compilation at /Users/ericfreese/bin/git-diff-blame line 57, <$diff> line 4.
Use of uninitialized value $prefilename in regexp compilation at /Users/ericfreese/bin/git-diff-blame line 54, <$diff> line 5.
Use of uninitialized value $postfilename in regexp compilation at /Users/ericfreese/bin/git-diff-blame line 57, <$diff> line 5.
Use of uninitialized value $prefilename in regexp compilation at /Users/ericfreese/bin/git-diff-blame line 54, <$diff> line 6.
Use of uninitialized value $postfilename in regexp compilation at /Users/ericfreese/bin/git-diff-blame line 57, <$diff> line 6.
Use of uninitialized value $pre in <HANDLE> at /Users/ericfreese/bin/git-diff-blame line 79.
readline() on unopened filehandle at /Users/ericfreese/bin/git-diff-blame line 79.
Use of uninitialized value $line in pattern match (m//) at /Users/ericfreese/bin/git-diff-blame line 21.
Use of uninitialized value $line in concatenation (.) or string at /Users/ericfreese/bin/git-diff-blame line 21.
bad blame output:  at /Users/ericfreese/bin/git-diff-blame line 21.

I'm on OSX with perl v5.18.2.

Any thoughts on what could be causing this? I haven't looked too deeply myself, but I haven't worked with perl in years...

@alikins
Copy link

alikins commented Jun 30, 2017

I ran into some variation of this, some of which seem related to how git is configured to format diffs.
The 'diff.noprefix' and 'diff.mnemonicPrefix' iirc. Settings those back to the default seemed to make progress.

I managed to munge it to work for the case I needed with this patch (warning: I don't know perl...):

diff --git a/git-diff-blame b/git-diff-blame
index faf7075..5fc9006 100755
--- a/git-diff-blame
+++ b/git-diff-blame
@@ -18,8 +18,12 @@ sub parse_hunk_header {
 
 sub get_blame_prefix {
        my ($line) = @_;
-       $line =~ /^(\^?[0-9a-f]+\s+(\S+\s+)?\([^\)]+\))/ or die "bad blame output: $line";
-       return $1;
+    if ($line) {
+           $line =~ /^(\^?[0-9a-f]+\s+(\S+\s+)?\([^\)]+\))/ or die "bad blame output: $line";
+        return $1;
+    } else {
+        return ;
+    }
 }
 
 $git_root = `git rev-parse --show-toplevel`;
@@ -27,10 +31,10 @@ $git_root =~ s/^\s+//;
 $git_root =~ s/\s+$//;
 chdir($git_root) or die "$!";
 
-my ($oldrev, $newrev) = @ARGV;
+my ($oldrev, $newrev, @REST) = @ARGV;
 $oldrev ||= 'HEAD';
 if ($newrev) {
-       open($diff, '-|', 'git', '--no-pager', 'diff', $oldrev, $newrev) or die;
+       open($diff, '-|', 'git', '--no-pager', 'diff', $oldrev, $newrev, @REST) or die;
 } else {
        open($diff, '-|', 'git', '--no-pager', 'diff', $oldrev) or die;
 }

hlovdal pushed a commit to hlovdal/git-diff-blame that referenced this issue Feb 2, 2022
hlovdal pushed a commit to hlovdal/git-diff-blame that referenced this issue Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants