denolehov / obsidian-git

Backup your Obsidian.md vault with git
MIT License
6.12k stars 251 forks source link

fix: getRelativeRepoPath for the case of vault-inside-repo #722

Closed tomoyanonymous closed 1 week ago

tomoyanonymous commented 2 months ago

This fixes #660.

Currently, getRelativeRepoPath considers only the case of git repository is located inside the vault. If the vault is inside a subdirectory of git repository (this is a common case when you are using a self-host publishing system like Quartz), line authoring feature won't work.

This code resolves the relative path between git repo and vault using path library.

Vinzent03 commented 1 week ago

Hey, thanks for this pr and your contribution! This was a great start, but I changed it so that the basePath setting is not needed to point to the repo root, but can be a subdirectory. Additionally, I needed to align the getRelativeVaultPath method as well. Let me know if you think something is off now. Thanks again.

tomoyanonymous commented 1 week ago

Hi. Thanks for the fixing. It works as I supposed. There is still edge case, for example, my repository have vault directory(/content/), and the vault have submodule directory (/content/private). On the files inside submodule, it fails to show line author info. This is not usual usecase, so I think it is ok to merge and open another issue.

Vinzent03 commented 1 week ago

Okay great. But the submodule issue was there before this pr and persisted after your version of this pr as well, right?

tomoyanonymous commented 1 week ago

Yes.

0atman commented 1 week ago

thanks folks!