From b11bad1326100b402d32f1498715a3645dfa2396 Mon Sep 17 00:00:00 2001 From: saberzero1 Date: Mon, 16 Mar 2026 11:55:47 +0100 Subject: [PATCH] fix(plugin): default to HEAD instead of main --- quartz/plugins/loader/gitLoader.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/quartz/plugins/loader/gitLoader.ts b/quartz/plugins/loader/gitLoader.ts index aaf7c470a..0aae42b9c 100644 --- a/quartz/plugins/loader/gitLoader.ts +++ b/quartz/plugins/loader/gitLoader.ts @@ -23,7 +23,7 @@ export interface GitPluginSpec { name: string /** Git repository URL or absolute local path */ repo: string - /** Git ref (branch, tag, or commit hash). Defaults to 'main' */ + /** Git ref (branch, tag, or commit hash). Omit to use the remote's default branch. */ ref?: string /** Optional subdirectory within the repo if plugin is not at root */ subdir?: string @@ -80,7 +80,7 @@ export function parsePluginSource(source: string): GitPluginSpec { return { name: repo, repo: `https://github.com/${owner}/${repo}.git`, - ref: ref || "main", + ref: ref || undefined, } } @@ -89,14 +89,14 @@ export function parsePluginSource(source: string): GitPluginSpec { const raw = source.replace("git+", "") const [url, ref] = raw.split("#") const name = extractRepoName(url) - return { name, repo: url, ref: ref || "main" } + return { name, repo: url, ref: ref || undefined } } // Handle direct HTTPS URL (GitHub, GitLab, etc.) if (source.startsWith("https://")) { const [url, ref] = source.split("#") const name = extractRepoName(url) - return { name, repo: url, ref: ref || "main" } + return { name, repo: url, ref: ref || undefined } } // Assume it's a plain repo name and try github @@ -105,7 +105,6 @@ export function parsePluginSource(source: string): GitPluginSpec { return { name: parts[1], repo: `https://github.com/${source}.git`, - ref: "main", } } @@ -198,7 +197,8 @@ export async function installPlugin( } if (options.verbose) { - console.log(styleText("cyan", `→`), `Cloning ${spec.name} from ${spec.repo}#${spec.ref}...`) + const refSuffix = spec.ref ? `#${spec.ref}` : "" + console.log(styleText("cyan", `→`), `Cloning ${spec.name} from ${spec.repo}${refSuffix}...`) } // Clone the repository