mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-24 13:37:34 +03:00
Merge pull request #3372 from tobyjwebb/bitbucket-branch-url
Fix opening remote branch on BitBucket repos
This commit is contained in:
commit
4e7a6755a0
@ -288,11 +288,11 @@ export class BaseBranch {
|
||||
}
|
||||
|
||||
commitUrl(commitId: string): string | undefined {
|
||||
// if repoBaseUrl is bitbucket, then the commit url is different
|
||||
if (this.repoBaseUrl.includes('bitbucket.org')) {
|
||||
// Different Git providers use different paths for the commit url:
|
||||
if (this.isBitBucket) {
|
||||
return `${this.repoBaseUrl}/commits/${commitId}`;
|
||||
}
|
||||
if (this.repoBaseUrl.includes('gitlab.com')) {
|
||||
if (this.isGitlab) {
|
||||
return `${this.repoBaseUrl}/-/commit/${commitId}`;
|
||||
}
|
||||
return `${this.repoBaseUrl}/commit/${commitId}`;
|
||||
@ -306,6 +306,18 @@ export class BaseBranch {
|
||||
if (!upstreamBranchName) return undefined;
|
||||
const baseBranchName = this.branchName.split('/')[1];
|
||||
const branchName = upstreamBranchName.split('/').slice(3).join('/');
|
||||
if (this.isBitBucket) {
|
||||
return `${this.repoBaseUrl.trim()}/branch/${branchName}?dest=${baseBranchName}`;
|
||||
}
|
||||
// The following branch path is good for at least Gitlab and Github:
|
||||
return `${this.repoBaseUrl.trim()}/compare/${baseBranchName}...${branchName}`;
|
||||
}
|
||||
|
||||
private get isBitBucket(): boolean {
|
||||
return this.repoBaseUrl.includes('bitbucket.org');
|
||||
}
|
||||
|
||||
private get isGitlab(): boolean {
|
||||
return this.repoBaseUrl.includes('gitlab.com');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user