Skip to content

Commit

Permalink
Use 3-dot compare URL for GitHub (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
IonBazan authored Aug 2, 2024
1 parent 7bf011c commit 4f10027
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/Url/GithubGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function getCompareUrl(PackageInterface $initialPackage, PackageInterface
$targetMaintainer = $this->getUser($targetPackage);
$targetVersion = ($baseMaintainer !== $targetMaintainer ? $targetMaintainer.':' : '').$this->getCompareRef($targetPackage);

return sprintf('%s/compare/%s..%s', $baseUrl, $this->getCompareRef($initialPackage), $targetVersion);
return sprintf('%s/compare/%s...%s', $baseUrl, $this->getCompareRef($initialPackage), $targetVersion);
}

/**
Expand Down
36 changes: 18 additions & 18 deletions tests/Command/DiffCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ public function outputDataProvider()
),
'Markdown with URLs' => array(
<<<OUTPUT
| Prod Packages | Operation | Base | Target | Link |
|----------------------------|------------|-------|--------|--------------------------------------------|
| [a/package-1](github.com) | New | - | 1.0.0 | [Compare](github.com/releases/tag/1.0.0) |
| [a/package-2](github.com) | Upgraded | 1.0.0 | 1.2.0 | [Compare](github.com/compare/1.0.0..1.2.0) |
| [a/package-3](github.com) | Removed | 0.1.1 | - | [Compare](github.com/releases/tag/0.1.1) |
| [a/package-4](gitlab.org) | Removed | 0.1.1 | - | [Compare](gitlab.org/tags/0.1.1) |
| [a/package-5](gitlab2.org) | Removed | 0.1.1 | - | [Compare](gitlab2.org/tags/0.1.1) |
| a/package-6 | Removed | 0.1.1 | - | |
| [a/package-7](github.com) | Downgraded | 1.2.0 | 1.0.0 | [Compare](github.com/compare/1.2.0..1.0.0) |
| Prod Packages | Operation | Base | Target | Link |
|----------------------------|------------|-------|--------|---------------------------------------------|
| [a/package-1](github.com) | New | - | 1.0.0 | [Compare](github.com/releases/tag/1.0.0) |
| [a/package-2](github.com) | Upgraded | 1.0.0 | 1.2.0 | [Compare](github.com/compare/1.0.0...1.2.0) |
| [a/package-3](github.com) | Removed | 0.1.1 | - | [Compare](github.com/releases/tag/0.1.1) |
| [a/package-4](gitlab.org) | Removed | 0.1.1 | - | [Compare](gitlab.org/tags/0.1.1) |
| [a/package-5](gitlab2.org) | Removed | 0.1.1 | - | [Compare](gitlab2.org/tags/0.1.1) |
| a/package-6 | Removed | 0.1.1 | - | |
| [a/package-7](github.com) | Downgraded | 1.2.0 | 1.0.0 | [Compare](github.com/compare/1.2.0...1.0.0) |
OUTPUT
Expand All @@ -161,15 +161,15 @@ public function outputDataProvider()
),
'Markdown with URLs and custom gitlab domains' => array(
<<<OUTPUT
| Prod Packages | Operation | Base | Target | Link |
|----------------------------|------------|-------|--------|--------------------------------------------|
| [a/package-1](github.com) | New | - | 1.0.0 | [Compare](github.com/releases/tag/1.0.0) |
| [a/package-2](github.com) | Upgraded | 1.0.0 | 1.2.0 | [Compare](github.com/compare/1.0.0..1.2.0) |
| [a/package-3](github.com) | Removed | 0.1.1 | - | [Compare](github.com/releases/tag/0.1.1) |
| [a/package-4](gitlab.org) | Removed | 0.1.1 | - | [Compare](gitlab.org/tags/0.1.1) |
| [a/package-5](gitlab2.org) | Removed | 0.1.1 | - | [Compare](gitlab2.org/tags/0.1.1) |
| [a/package-6](gitlab3.org) | Removed | 0.1.1 | - | [Compare](gitlab3.org/tags/0.1.1) |
| [a/package-7](github.com) | Downgraded | 1.2.0 | 1.0.0 | [Compare](github.com/compare/1.2.0..1.0.0) |
| Prod Packages | Operation | Base | Target | Link |
|----------------------------|------------|-------|--------|---------------------------------------------|
| [a/package-1](github.com) | New | - | 1.0.0 | [Compare](github.com/releases/tag/1.0.0) |
| [a/package-2](github.com) | Upgraded | 1.0.0 | 1.2.0 | [Compare](github.com/compare/1.0.0...1.2.0) |
| [a/package-3](github.com) | Removed | 0.1.1 | - | [Compare](github.com/releases/tag/0.1.1) |
| [a/package-4](gitlab.org) | Removed | 0.1.1 | - | [Compare](gitlab.org/tags/0.1.1) |
| [a/package-5](gitlab2.org) | Removed | 0.1.1 | - | [Compare](gitlab2.org/tags/0.1.1) |
| [a/package-6](gitlab3.org) | Removed | 0.1.1 | - | [Compare](gitlab3.org/tags/0.1.1) |
| [a/package-7](github.com) | Downgraded | 1.2.0 | 1.0.0 | [Compare](github.com/compare/1.2.0...1.0.0) |
OUTPUT
Expand Down
12 changes: 6 additions & 6 deletions tests/Url/GithubGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,32 +70,32 @@ public function compareUrlProvider()
'same maintainer' => array(
$this->getPackageWithSource('acme/package', '3.12.0', 'https://github.com/acme/package.git'),
$this->getPackageWithSource('acme/package', '3.12.1', 'https://github.com/acme/package.git'),
'https://github.com/acme/package/compare/3.12.0..3.12.1',
'https://github.com/acme/package/compare/3.12.0...3.12.1',
),
'without .git' => array(
$this->getPackageWithSource('acme/package', '3.12.0', 'https://github.com/acme/package'),
$this->getPackageWithSource('acme/package', '3.12.1', 'https://github.com/acme/package'),
'https://github.com/acme/package/compare/3.12.0..3.12.1',
'https://github.com/acme/package/compare/3.12.0...3.12.1',
),
'dev versions' => array(
$this->getPackageWithSource('acme/package', 'dev-master', 'https://github.com/acme/package.git', 'd46283075d76ed244f7825b378eeb1cee246af73'),
$this->getPackageWithSource('acme/package', 'dev-master', 'https://github.com/acme/package.git', '9b860214d58c48b5cbe99bdb17914d0eb723c9cd'),
'https://github.com/acme/package/compare/d462830..9b86021',
'https://github.com/acme/package/compare/d462830...9b86021',
),
'invalid or short reference' => array(
$this->getPackageWithSource('acme/package', 'dev-master', 'https://github.com/acme/package.git', 'd462830'),
$this->getPackageWithSource('acme/package', 'dev-master', 'https://github.com/acme/package.git', '1'),
'https://github.com/acme/package/compare/d462830..1',
'https://github.com/acme/package/compare/d462830...1',
),
'compare with base fork' => array(
$this->getPackageWithSource('acme/package', '3.12.0', 'https://github.com/IonBazan/package.git'),
$this->getPackageWithSource('acme/package', '3.12.1', 'https://github.com/acme/package.git'),
'https://github.com/IonBazan/package/compare/3.12.0..acme:3.12.1',
'https://github.com/IonBazan/package/compare/3.12.0...acme:3.12.1',
),
'compare with head fork' => array(
$this->getPackageWithSource('acme/package', '3.12.0', 'https://github.com/acme/package.git'),
$this->getPackageWithSource('acme/package', '3.12.1', 'https://github.com/IonBazan/package.git'),
'https://github.com/acme/package/compare/3.12.0..IonBazan:3.12.1',
'https://github.com/acme/package/compare/3.12.0...IonBazan:3.12.1',
),
'compare with different repository provider' => array(
$this->getPackageWithSource('acme/package', '3.12.0', 'https://github.com/acme/package.git'),
Expand Down

0 comments on commit 4f10027

Please sign in to comment.