fix: normalize gitlab remote path suffixes (#4277)
This commit is contained in:
@@ -93,6 +93,17 @@ describe('gitlab project ref parsing', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('strips trailing slashes after .git suffixes', () => {
|
||||
expect(parseGitLabProjectRef('https://gitlab.com/acme/widgets.git/')).toEqual({
|
||||
host: 'gitlab.com',
|
||||
path: 'acme/widgets'
|
||||
})
|
||||
expect(parseGitLabProjectRef('ssh://git@gitlab.com/acme/widgets.git/')).toEqual({
|
||||
host: 'gitlab.com',
|
||||
path: 'acme/widgets'
|
||||
})
|
||||
})
|
||||
|
||||
it('preserves git protocol remote support', () => {
|
||||
expect(parseGitLabProjectRef('git://gitlab.com/acme/widgets.git')).toEqual({
|
||||
host: 'gitlab.com',
|
||||
|
||||
@@ -138,7 +138,7 @@ function normalizeHost(value: string): string {
|
||||
}
|
||||
|
||||
function stripGitSuffix(path: string): string {
|
||||
return path.replace(/\.git$/i, '')
|
||||
return path.replace(/\/+$/, '').replace(/\.git$/i, '')
|
||||
}
|
||||
|
||||
function makeProjectRef(
|
||||
|
||||
Reference in New Issue
Block a user