Skip to content

Add the option to modify the repo root relative path #73

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

Closed
wants to merge 1 commit into from

Conversation

orgrinrt
Copy link

@orgrinrt orgrinrt commented Feb 5, 2025

This PR adds the option to set a relative path from the graph's path to consider the git repo root.

For use cases like mine, where I have several graphs under one central repo, that also contains the logseq configuration and some scripts to initialise a new device to use it with the same plugins, settings and such shared between the graphs.

So basically it currently just appends the input of the new setting to the currentGitFolder constant defined in the git helper function execGitCommand scope.

Seems to work for me, but this might have problems on other platforms. I'm on latest macos, so at least that works.

Initially I though I'd use the common utility libs (in this case, path) I thought I remembered, from some earlier web work years ago, were easily available to node context, but I couldn't quickly figure out what extra steps that requires here. I'm not so familiar with the current web frameworks, so I couldn't be bothered to mess with it, and this happens to work for my devices as-is.

I thought I'd send the PR either way, just in case logseq handles the path normalisation under the hood, since I'm not aware how the execGit or logseq.Git things work internally. Shouldn't take much to just adapt this quick addition, but maybe it's not worth the hassle if it takes more. So please do ignore this in that case, and close the PR.

Unfortunately I had some internal linter running through the code I now see from the diffs. If this seems worth a merge, I can clean up those changes, just ping me.

_inProgress = logseq.Git.execCommand(runArgs)
res = await _inProgress
const currentGitFolder = (await logseq.App.getCurrentGraph())?.path;
const relCurrGitFolder = currentGitFolder
Copy link
Author

@orgrinrt orgrinrt Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new constant (and using it instead of currentGitFolder on the git exec args) is essentially the only change other than the settings addition in src/helper/constants.ts

I apologise for the linter, didn't think to check the diffs on the fly before sending this PR.

Again, I'd be happy to clean it up if this seems worth a merge.

@orgrinrt
Copy link
Author

orgrinrt commented Feb 5, 2025

I see this feature has also been requested before. See, for example this comment in #67. If there are problems with this specific way of achieving it, I'd be happy to get some feedback and implement it in a suitable way, as it seems it would help others too.

@orgrinrt
Copy link
Author

orgrinrt commented Feb 6, 2025

Closing this in favour of #74

@orgrinrt orgrinrt closed this Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant