Skip to content

Fixed: Add the option to modify the repo root relative path #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/helper/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 10 additions & 2 deletions src/helper/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@ export const execGitCommand = async (args: string[]) : Promise<IGitResult> => {

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 {
Expand Down