From af157d4e2ff926db247ee41bb7b250a5b3e108a3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 5 Apr 2026 05:27:38 +0000 Subject: [PATCH 1/2] Add GitLab and Bitbucket commit URL support Support generating commit links for GitLab (/-/commit/) and Bitbucket (/commits/) repositories in addition to the existing GitHub and Drupal support. https://claude.ai/code/session_01DojFg6i8pu5sfxHBtSzhPM --- src/ChangeLogData.php | 8 ++++++++ tests/Unit/ChangelogTest.php | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/ChangeLogData.php b/src/ChangeLogData.php index 470ae2d..8214a54 100644 --- a/src/ChangeLogData.php +++ b/src/ChangeLogData.php @@ -37,6 +37,8 @@ protected function gitSourceIsSupported($git) { $suported_prefixes = [ 'https://github.com/', + 'https://gitlab.com/', + 'https://bitbucket.org/', 'https://git.drupal.org', 'https://git.drupalcode.org' ]; @@ -132,6 +134,12 @@ protected function getCommitUrl($url, $commit) case 'github.com': return sprintf('%s/commit/%s', $url, $commit); + case 'gitlab.com': + return sprintf('%s/-/commit/%s', $url, $commit); + + case 'bitbucket.org': + return sprintf('%s/commits/%s', $url, $commit); + case 'git.drupalcode.org': case 'git.drupal.org': $project_name = str_replace('/project/', '', $url_parsed['path']); diff --git a/tests/Unit/ChangelogTest.php b/tests/Unit/ChangelogTest.php index 482e24d..1de6b53 100644 --- a/tests/Unit/ChangelogTest.php +++ b/tests/Unit/ChangelogTest.php @@ -48,6 +48,26 @@ public function testWithNewDrupalLinks() ', $markdown); } + public function testWithGitlabLinks() + { + $data = ChangeLogData::createFromString("ababab change 1\nfefefe change 2"); + $data->setGitSource('https://gitlab.com/eiriksm/violinist'); + $markdown = $data->getAsMarkdown(); + $this->assertEquals('- [ababab](https://gitlab.com/eiriksm/violinist/-/commit/ababab) `change 1` +- [fefefe](https://gitlab.com/eiriksm/violinist/-/commit/fefefe) `change 2` +', $markdown); + } + + public function testWithBitbucketLinks() + { + $data = ChangeLogData::createFromString("ababab change 1\nfefefe change 2"); + $data->setGitSource('https://bitbucket.org/violinist-dev/git-log-format'); + $markdown = $data->getAsMarkdown(); + $this->assertEquals('- [ababab](https://bitbucket.org/violinist-dev/git-log-format/commits/ababab) `change 1` +- [fefefe](https://bitbucket.org/violinist-dev/git-log-format/commits/fefefe) `change 2` +', $markdown); + } + public function testEmptyLines() { $data = ChangeLogData::createFromString(""); From 6ebf5e95d25e0ea757421e78880f5a0c63e31e91 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 5 Apr 2026 05:28:01 +0000 Subject: [PATCH 2/2] Add .phpunit.result.cache to .gitignore https://claude.ai/code/session_01DojFg6i8pu5sfxHBtSzhPM --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 23cc0d4..f5971fc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ vendor .idea /data composer.lock +.phpunit.result.cache