blob: 82ef0be1dfd9420414b5476beeb6458df746fa67 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import getDefaultBranch from './get-default-branch.js';
import getCurrentGitRef from './get-current-git-ref.js';
/** Detects if the current view is on the default branch. To be used on file/folder/commit lists */
export default async function isDefaultBranch(): Promise<boolean> {
const currentBranch = getCurrentGitRef();
if (!currentBranch) {
// This happens on the repo root OR on views that are not branch-specific (like isIssue)
return true;
}
return currentBranch === await getDefaultBranch();
}
|