From 2a81f10492d893b59ca2bf0ac6bc795b7dd5db5b Mon Sep 17 00:00:00 2001 From: Grigory Date: Mon, 23 Feb 2026 04:43:09 +0500 Subject: [PATCH 1/2] Fix `isEmptyRepoRoot` --- index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.ts b/index.ts index fe4450b..bfca917 100644 --- a/index.ts +++ b/index.ts @@ -397,8 +397,7 @@ TEST: addTests('isRepo', [ export const hasRepoHeader = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepo(url) && !isRepoSearch(url); TEST: addTests('hasRepoHeader', combinedTestOnly); -// On empty repos, there's only isRepoHome; this element is found in `` -export const isEmptyRepoRoot = (): boolean => isRepoHome() && !exists('link[rel="canonical"]'); +export const isEmptyRepoRoot = (): boolean => isRepoHome() && exists('.blankslate-icon, #empty-setup-clone-url'); export const isEmptyRepo = (): boolean => exists('[aria-label="Cannot fork because repository is empty."]'); From dcea46ef5443a31e1d16a1fcf5cd41a838706f31 Mon Sep 17 00:00:00 2001 From: Grigory Date: Thu, 26 Feb 2026 17:47:17 +0500 Subject: [PATCH 2/2] add comments --- index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index bfca917..93aacc1 100644 --- a/index.ts +++ b/index.ts @@ -397,7 +397,12 @@ TEST: addTests('isRepo', [ export const hasRepoHeader = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepo(url) && !isRepoSearch(url); TEST: addTests('hasRepoHeader', combinedTestOnly); -export const isEmptyRepoRoot = (): boolean => isRepoHome() && exists('.blankslate-icon, #empty-setup-clone-url'); +export const isEmptyRepoRoot = (): boolean => isRepoHome() && exists([ + // If you don't have write access + '.blankslate-icon', + // If you have write access + '#empty-setup-clone-url', +].join(',')); export const isEmptyRepo = (): boolean => exists('[aria-label="Cannot fork because repository is empty."]');