From 02de6db9c8e0e5d84837b75536521de737eb959c Mon Sep 17 00:00:00 2001 From: Stig Lindqvist Date: Wed, 11 May 2016 11:07:53 +1200 Subject: [PATCH] Fix GPG signed commits will break on reading full commit message --- src/Gitonomy/Git/Parser/CommitParser.php | 4 ++++ tests/Gitonomy/Git/Tests/CommitTest.php | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/Gitonomy/Git/Parser/CommitParser.php b/src/Gitonomy/Git/Parser/CommitParser.php index 804fc1f..eba71e4 100644 --- a/src/Gitonomy/Git/Parser/CommitParser.php +++ b/src/Gitonomy/Git/Parser/CommitParser.php @@ -45,6 +45,10 @@ protected function doParse() $this->consume('committer '); list($this->committerName, $this->committerEmail, $this->committerDate) = $this->consumeNameEmailDate(); $this->committerDate = $this->parseDate($this->committerDate); + + // will consume an GPG signed commit if there is one + $this->consumeGPGSignature(); + $this->consumeNewLine(); $this->consumeNewLine(); diff --git a/tests/Gitonomy/Git/Tests/CommitTest.php b/tests/Gitonomy/Git/Tests/CommitTest.php index 84b0206..8a7c2c6 100644 --- a/tests/Gitonomy/Git/Tests/CommitTest.php +++ b/tests/Gitonomy/Git/Tests/CommitTest.php @@ -185,6 +185,18 @@ public function testGetMessage($repository) $this->assertEquals('add a long file'."\n", $commit->getMessage()); } + /** + * This test ensures that GPG signed commits does not break the reading of a commit + * message. + * + * @dataProvider provideFoobar + */ + public function testGetSignedMessage($repository) + { + $commit = $repository->getCommit(self::SIGNED_COMMIT); + $this->assertEquals('signed commit'."\n", $commit->getMessage()); + } + /** * @dataProvider provideFoobar */