diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cdc43d..747cf88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixed - `dependency-graph` binary crashed due to undefined method call +- Trimming `.git` extension that may lead to invalid beahviours ## 3.9.0 - 2026-02-28 diff --git a/src/Loader/ComposerLock.php b/src/Loader/ComposerLock.php index ac4ea08..f7fdc33 100644 --- a/src/Loader/ComposerLock.php +++ b/src/Loader/ComposerLock.php @@ -62,7 +62,11 @@ public function __invoke(Path $path): Set Is::shape( 'url', Is::string() - ->map(static fn($value) => \rtrim($value, '.git').'/') + ->map(static fn($value) => match (\str_ends_with($value, '.git')) { + true => \substr($value, 0, -4), + false => $value, + }) + ->map(static fn($value) => $value.'/') ->map(Url::maybe(...)), ) ->optional('url')