Skip to content

Commit de03597

Browse files
Consume merge tag (#231)
1 parent 64d8e79 commit de03597

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/Gitonomy/Git/Parser/CommitParser.php

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ protected function doParse()
4747
list($this->committerName, $this->committerEmail, $committerDate) = $this->consumeNameEmailDate();
4848
$this->committerDate = $this->parseDate($committerDate);
4949

50+
$this->consumeMergeTag();
51+
5052
// will consume an GPG signed commit if there is one
5153
$this->consumeGPGSignature();
5254

src/Gitonomy/Git/Parser/LogParser.php

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ protected function doParse()
4545
list($commit['committerName'], $commit['committerEmail'], $committerDate) = $this->consumeNameEmailDate();
4646
$commit['committerDate'] = $this->parseDate($committerDate);
4747

48+
$this->consumeMergeTag();
49+
4850
// will consume an GPG signed commit if there is one
4951
$this->consumeGPGSignature();
5052

src/Gitonomy/Git/Parser/ParserBase.php

+14
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,18 @@ protected function consumeGPGSignature()
136136

137137
return $this->consumeTo("\n\n");
138138
}
139+
140+
protected function consumeMergeTag()
141+
{
142+
$expected = "\nmergetag ";
143+
$length = strlen($expected);
144+
$actual = substr($this->content, $this->cursor, $length);
145+
if ($actual != $expected) {
146+
return '';
147+
}
148+
$this->cursor += $length;
149+
150+
$this->consumeTo('-----END PGP SIGNATURE-----');
151+
$this->consume('-----END PGP SIGNATURE-----');
152+
}
139153
}

0 commit comments

Comments
 (0)