From 6691d29e4724eea24d799db596eb9940241e8238 Mon Sep 17 00:00:00 2001 From: Vanesa Date: Fri, 26 Oct 2018 11:20:04 -0700 Subject: [PATCH] fix go-to-gitlab link to branch, commit range and line (#532) * fix go-to-gitlab link to branch, commit range and line --- src/repo/actions/GoToCodeHostAction.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/repo/actions/GoToCodeHostAction.tsx b/src/repo/actions/GoToCodeHostAction.tsx index ae5742458ba..68f6f8d6de2 100644 --- a/src/repo/actions/GoToCodeHostAction.tsx +++ b/src/repo/actions/GoToCodeHostAction.tsx @@ -108,18 +108,18 @@ export class GoToCodeHostAction extends React.PureComponent { const { displayName, icon } = serviceTypeDisplayNameAndIcon(externalURL.serviceType) const Icon = icon || ExportIcon - // Special-case for GitHub: add branch and line numbers to URL. + // Extract url to add branch, line numbers or commit range. let url = externalURL.url - if (externalURL.serviceType === 'github') { - // If in a branch, add branch path to the GitHub URL. + if (externalURL.serviceType === 'github' || externalURL.serviceType === 'gitlab') { + // If in a branch, add branch path to the code host URL. if (this.props.rev && this.props.rev !== defaultBranch && !this.state.fileExternalLinksOrError) { url += `/tree/${this.props.rev}` } - // If showing a comparison, add comparison specifier to the GitHub URL. + // If showing a comparison, add comparison specifier to the code host URL. if (this.props.commitRange) { url += `/compare/${this.props.commitRange.replace(/^\.\.\./, 'HEAD...').replace(/\.\.\.$/, '...HEAD')}` } - // Add range or position path to the GitHub URL. + // Add range or position path to the code host URL. if (this.props.range) { url += `#L${this.props.range.start.line}-L${this.props.range.end.line}` } else if (this.props.position) {