summaryrefslogtreecommitdiff
path: root/source/libs/get-default-branch.ts
diff options
context:
space:
mode:
Diffstat (limited to 'source/libs/get-default-branch.ts')
-rw-r--r--source/libs/get-default-branch.ts10
1 files changed, 2 insertions, 8 deletions
diff --git a/source/libs/get-default-branch.ts b/source/libs/get-default-branch.ts
index b056f0c6..11930d2a 100644
--- a/source/libs/get-default-branch.ts
+++ b/source/libs/get-default-branch.ts
@@ -16,14 +16,8 @@ function parseBranchFromDom(): string | undefined {
}
// We can find the name in the infobar, available in folder views
- const branchInfo = select('.branch-infobar');
- if (!branchInfo) {
- return;
- }
-
- // Parse the infobar
- const matches = branchInfoRegex.exec(branchInfo.textContent!.trim());
- return matches ? matches[1] : undefined;
+ const branchInfo = select('.branch-infobar')?.textContent?.trim();
+ return branchInfoRegex.exec(branchInfo!)?.[1];
}
async function fetchFromApi(): Promise<string> {