From: Dan Brook Date: Tue, 29 Jun 2010 09:48:16 +0000 (+0100) Subject: Bug fix for merge diffs and a test. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FGitalist.git;a=commitdiff_plain;h=swann Bug fix for merge diffs and a test. 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. --- diff --git a/lib/Gitalist/Git/Object/Commit.pm b/lib/Gitalist/Git/Object/Commit.pm index 465647d..7536a66 100644 --- a/lib/Gitalist/Git/Object/Commit.pm +++ b/lib/Gitalist/Git/Object/Commit.pm @@ -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; diff --git a/t/00git_version.t b/t/00git_version.t index 98c6e17..2b474fb 100644 --- a/t/00git_version.t +++ b/t/00git_version.t @@ -3,7 +3,7 @@ use warnings; use Test::More; -my $ver = `git --version`; +my($ver) = `git --version`; ok !$!; ok $ver; warn "Git version: $ver";