- Assumes all upstream branch names will start with 'refs/remotes/', then
- slices out the remote branch name without making any assumptions as to what it's named, and
- joins the rest of the split elements
This commit is contained in:
Juan P Barrios 2024-02-15 18:04:15 +02:00 committed by Kiril Videlov
parent 7ebcd41fec
commit 2cb9711c54

View File

@ -262,8 +262,7 @@ export class BaseBranch {
branchUrl(upstreamBranchName: string | undefined) {
if (!upstreamBranchName) return undefined;
const baseBranchName = this.branchName.split('/')[1];
const parts = upstreamBranchName.split('/');
const branchName = parts[parts.length - 1];
const branchName = upstreamBranchName.split('refs/remotes/')[1].split('/').slice(1).join('/');
return `${this.repoBaseUrl.trim()}/compare/${baseBranchName}...${branchName}`;
}
}