denolehov / obsidian-git

Backup your Obsidian.md vault with git
MIT License
6.14k stars 250 forks source link

[Bug]: Line author fails when the vault is a subdir of the git repo #660

Closed ptxmac closed 1 week ago

ptxmac commented 6 months ago

Describe the bug

For vaults that are not the root of a git repository the "line author" feature doesn't work

Relevant errors (if available) from notifications or console (CTRL+SHIFT+I)

obsidian-git. hash-object failed: fatal: could not open 'Readme.md' for reading: No such file or directory
eval @ plugin:obsidian-git:29800

plugin:obsidian-git:29119 Uncaught (in promise) Error: fatal: could not open 'Readme.md' for reading: No such file or directory

    at Object.action (plugin:obsidian-git:29119:25)
    at PluginStore.exec (plugin:obsidian-git:29144:25)
    at eval (plugin:obsidian-git:26649:43)
    at new Promise (<anonymous>)
    at GitExecutorChain.handleTaskData (plugin:obsidian-git:26647:16)
    at GitExecutorChain.eval (plugin:obsidian-git:26631:44)
    at Generator.next (<anonymous>)
    at fulfilled (plugin:obsidian-git:25476:24)

Steps to reproduce

Expected Behavior

The rest of obsidian git works fine for vaults that are not the root of a repository, so I would expect this feature to also work.

Addition context

No response

Operating system

macOS

Installation Method

None

Plugin version

2.22.0

micimize commented 4 months ago

Same issue on linux. Tried a few workarounds like GIT_PREFIX=notes/ or custom path = ../ or notes none of which worked (the latter logged partially sliced filenames in the terminal which was odd)

0atman commented 3 weeks ago

AHA so this is why my lineauthoring isn't working!

I believe the rest of the functionality is working, it's probably a relative paths assumption, I would guess.

Here's what the gutter looks like on my linux desktop with this bug:

image

And here it is when the vault is the root of the repo (as it should be in my case, so this was a fix for me!):

image