diff --git a/src/helper/constants.ts b/src/helper/constants.ts index 1de3088..52027ac 100644 --- a/src/helper/constants.ts +++ b/src/helper/constants.ts @@ -112,6 +112,14 @@ export const BUTTONS = [ ]; export const SETTINGS_SCHEMA: SettingSchemaDesc[] = [ + { + key: "customRepoRoot", + title: "Custom Repository Root Path", + type: "string", + default: "/", + description: + "Custom repository root, relative to the current graph root (can contain `..` path nodes). Defaults to /, which means the graph root.", + }, { key: "buttons", title: "Buttons", diff --git a/src/helper/git.ts b/src/helper/git.ts index a3e0468..0896dd0 100644 --- a/src/helper/git.ts +++ b/src/helper/git.ts @@ -8,8 +8,16 @@ export const execGitCommand = async (args: string[]) : Promise => { let res try { - const currentGitFolder = (await logseq.App.getCurrentGraph())?.path - const runArgs = currentGitFolder ? ['-C', currentGitFolder, ...args] : args + const currentGitFolder = (await logseq.App.getCurrentGraph())?.path; + const relCurrGitFolder = currentGitFolder + ? //path.resolve( + (((currentGitFolder as string) + + "/" + + logseq.settings?.customRepoRoot) as string) + : //) + (logseq.settings?.customRepoRoot as string); + const runArgs = relCurrGitFolder ? ["-C", relCurrGitFolder, ...args] : args; + //const runArgs = currentGitFolder ? ["-C", currentGitFolder, ...args] : args; _inProgress = logseq.Git.execCommand(runArgs) res = await _inProgress } finally {