Skip to content

Commit

Permalink
Consume merge tag (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-lorenc authored Feb 12, 2025
1 parent 64d8e79 commit de03597
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Gitonomy/Git/Parser/CommitParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ protected function doParse()
list($this->committerName, $this->committerEmail, $committerDate) = $this->consumeNameEmailDate();
$this->committerDate = $this->parseDate($committerDate);

$this->consumeMergeTag();

// will consume an GPG signed commit if there is one
$this->consumeGPGSignature();

Expand Down
2 changes: 2 additions & 0 deletions src/Gitonomy/Git/Parser/LogParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ protected function doParse()
list($commit['committerName'], $commit['committerEmail'], $committerDate) = $this->consumeNameEmailDate();
$commit['committerDate'] = $this->parseDate($committerDate);

$this->consumeMergeTag();

// will consume an GPG signed commit if there is one
$this->consumeGPGSignature();

Expand Down
14 changes: 14 additions & 0 deletions src/Gitonomy/Git/Parser/ParserBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,18 @@ protected function consumeGPGSignature()

return $this->consumeTo("\n\n");
}

protected function consumeMergeTag()
{
$expected = "\nmergetag ";
$length = strlen($expected);
$actual = substr($this->content, $this->cursor, $length);
if ($actual != $expected) {
return '';
}
$this->cursor += $length;

$this->consumeTo('-----END PGP SIGNATURE-----');
$this->consume('-----END PGP SIGNATURE-----');
}
}

0 comments on commit de03597

Please sign in to comment.