Skip to content

Commit b4b9164

Browse files
committed
minor #110 Fix GPG signed commits will break on reading full commit message (stojg)
This PR was merged into the 1.0-dev branch. Discussion ---------- Fix GPG signed commits will break on reading full commit message Ensure that we can get the full message when the commit has been GPG signed Follow up on #109 that only deals with the "log" part, this ensure that we can also return the message. Commits ------- 02de6db Fix GPG signed commits will break on reading full commit message
2 parents 37ad030 + 02de6db commit b4b9164

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/Gitonomy/Git/Parser/CommitParser.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ protected function doParse()
4545
$this->consume('committer ');
4646
list($this->committerName, $this->committerEmail, $this->committerDate) = $this->consumeNameEmailDate();
4747
$this->committerDate = $this->parseDate($this->committerDate);
48+
49+
// will consume an GPG signed commit if there is one
50+
$this->consumeGPGSignature();
51+
4852
$this->consumeNewLine();
4953

5054
$this->consumeNewLine();

tests/Gitonomy/Git/Tests/CommitTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,18 @@ public function testGetMessage($repository)
185185
$this->assertEquals('add a long file'."\n", $commit->getMessage());
186186
}
187187

188+
/**
189+
* This test ensures that GPG signed commits does not break the reading of a commit
190+
* message.
191+
*
192+
* @dataProvider provideFoobar
193+
*/
194+
public function testGetSignedMessage($repository)
195+
{
196+
$commit = $repository->getCommit(self::SIGNED_COMMIT);
197+
$this->assertEquals('signed commit'."\n", $commit->getMessage());
198+
}
199+
188200
/**
189201
* @dataProvider provideFoobar
190202
*/

0 commit comments

Comments
 (0)