Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const getRemote = (remoteURL, options = {}) => {

const IS_BITBUCKET = /bitbucket/.test(hostname)
const IS_GITLAB = /gitlab/.test(hostname)
const IS_GITLAB_SUBGROUP = /\.git$/.test(remote.branch)
const IS_AZURE = /dev\.azure/.test(hostname)
const IS_VISUAL_STUDIO = /visualstudio/.test(hostname)

Expand All @@ -43,9 +42,7 @@ const getRemote = (remoteURL, options = {}) => {
}

if (IS_GITLAB) {
const url = IS_GITLAB_SUBGROUP
? `${protocol}//${hostname}/${remote.repo}/${remote.branch.replace(/\.git$/, '')}`
: `${protocol}//${hostname}/${remote.repo}`
const url = `${protocol}//${hostname}/${remote.pathname.replace(/git@.*:/, '').replace(/\.git$/, '')}`
return {
getCommitLink: id => `${url}/commit/${id}`,
getIssueLink: id => `${url}/issues/${id}`,
Expand Down
12 changes: 12 additions & 0 deletions test/remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ const TEST_DATA = [
compare: 'https://gitlab.com/user/repo/subgroup/compare/v1.2.3...v2.0.0'
}
},
{
remotes: [
'https://gitlab.com/user/repo/group/repo.git',
'[email protected]:user/repo/group/repo.git'
],
expected: {
commit: 'https://gitlab.com/user/repo/group/repo/commit/123',
issue: 'https://gitlab.com/user/repo/group/repo/issues/123',
merge: 'https://gitlab.com/user/repo/group/repo/merge_requests/123',
compare: 'https://gitlab.com/user/repo/group/repo/compare/v1.2.3...v2.0.0'
}
},
{
remotes: [
'https://bitbucket.org/user/repo',
Expand Down