Bug fix for merge diffs and a test.
Dan Brook [Tue, 29 Jun 2010 09:48:16 +0000 (10:48 +0100)]
In the case of the merge diff fix we now check if $parent has
something to be compared against before making a comparison.

The case of the t/00git_version.t fix is a little more
interesting. For reasons I don't fully understand running a program
which writes to stdout in scalar context has $! is set to 9 (aka
"Bad file descriptor"). Something to do with close-on-exec I think.

lib/Gitalist/Git/Object/Commit.pm
t/00git_version.t

index 465647d..7536a66 100644 (file)
@@ -62,7 +62,7 @@ class Gitalist::Git::Object::Commit
 
            # If we're not comparing against something and we have multiple
            # parents then it's a merge commit so show what was merged.
-           my $sha1 = $parent eq '-c' && @{[$self->parents]} > 1
+           my $sha1 = $parent && $parent eq '-c' && @{[$self->parents]} > 1
                 ? sprintf("%s^1..%s^2", ($self->sha1) x 2)
                      : $self->sha1;
 
index 98c6e17..2b474fb 100644 (file)
@@ -3,7 +3,7 @@ use warnings;
 
 use Test::More;
 
-my $ver = `git --version`;
+my($ver) = `git --version`;
 ok !$!;
 ok $ver;
 warn "Git version: $ver";