Skip to content

Commit c6e471a

Browse files
committed
Clean up
1 parent a56db08 commit c6e471a

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/github/createPRViewProvider.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -687,11 +687,15 @@ export class CreatePullRequestViewProvider extends BaseCreatePullRequestViewProv
687687
return { title, description };
688688
}
689689

690+
const name = compareBranch.name;
691+
const branchNameTitle = (name: string) => {
692+
return `${name.charAt(0).toUpperCase()}${name.slice(1)}`;
693+
};
694+
690695
// If branchName is selected, use the branch name as the title
691696
if (descriptionSource === 'branchName') {
692-
const name = compareBranch.name;
693697
if (name) {
694-
title = `${name.charAt(0).toUpperCase()}${name.slice(1)}`;
698+
title = branchNameTitle(name);
695699
}
696700
return { title, description };
697701
}
@@ -704,7 +708,6 @@ export class CreatePullRequestViewProvider extends BaseCreatePullRequestViewProv
704708
let useBranchName = this._pullRequestDefaults.base === compareBranch.name;
705709
Logger.debug(`Compare branch name: ${compareBranch.name}, Base branch name: ${this._pullRequestDefaults.base}`, CreatePullRequestViewProvider.ID);
706710
try {
707-
const name = compareBranch.name;
708711
const [totalCommits, lastCommit, pullRequestTemplate] = await Promise.all([
709712
this.getTotalGitHubCommits(compareBranch, baseBranch),
710713
name ? titleAndBodyFrom(promiseWithTimeout(this._folderRepositoryManager.getTipCommitMessage(name), 5000)) : undefined,
@@ -730,7 +733,7 @@ export class CreatePullRequestViewProvider extends BaseCreatePullRequestViewProv
730733
}
731734
// Set title
732735
if (useBranchName && name) {
733-
title = `${name.charAt(0).toUpperCase()}${name.slice(1)}`;
736+
title = branchNameTitle(name);
734737
} else if (name && lastCommit) {
735738
title = lastCommit.title;
736739
}

0 commit comments

Comments
 (0)