lostintangent / gitdoc

VS Code extension that allows you to edit a Git repo, like it's a multi-file, versioned document.
https://aka.ms/gitdoc
MIT License
274 stars 24 forks source link

GitDoc isn't creating a commit on save #61

Open tompaton opened 1 year ago

tompaton commented 1 year ago

This looks like a perfect extension for what I'm after but I'm having trouble configuring it. I've installed the extension and made the following settings changes (workspace.json):

{"folders": [
...
        {"path": "../../../../dev/notes"}
    ],
    "settings": {
        "gitdoc.enabled": true,
        "gitdoc.pushMode": "push",
        "gitdoc.commitValidationLevel": "none",
        "gitdoc.filePattern": "/home/tom/dev/notes**/*"
    }
}

That is because I only want to auto commit for the repo in that specific folder (and I turned off the validation just in case that was the cause). I see the GitDoc icon in the status bar for the files as I expect, however saving changes doesn't seem to trigger anything. I can manually commit/push/pull using the VS.Code Source Control and GitLens tabs. The only other thing I can think of is maybe the branch name is throwing GitDoc off:

tom@sulfur:~/dev/notes$ git st
On branch autocommit
Your branch is up to date with 'origin/autocommit'.

Is there debug/console output for GitDoc I can inspect/include? Any help diagnosing this would be appreciated.

lostintangent commented 1 year ago

Hey! So just to confirm: the GitDoc status bar icon only appears when you open a file that matches the configured file pattern? And it's hidden when you open non-matching files? If so, that would definitely confirm that the file pattern is working as expected 🤔

The name of the branch shouldn't have an impact, since GitDoc simply pushes changes to the current git branch, and therefore, never even looks at the name.

That said, I wonder if there's an issue with multi-rooted workspaces. If instead of opening a workspace, you simply opened a folder of your notes, do you see the right auto-commit behavior happening? I'll look into this as well, since this is my first hunch about the issue.

tompaton commented 1 year ago

Yes, good guess! I opened just the notes folder and it pulled, committed and pushed as expected!

lostintangent commented 1 year ago

OK great, thanks for confirming that. I'll take a look and see how to add support for workspaces.

arulrajnet commented 1 year ago

Waiting for this support.

I am using this extension with foambubble https://foambubble.github.io/foam/user/getting-started/recommended-extensions

thesobercoder commented 11 months ago

@lostintangent Has the workspace support been merged? Eagerly waiting.

JackFinnZinc commented 10 months ago

Thanks @lostintangent for this tool! 🙂

For those of you waiting for a 'fix' (@thesobercoder), it's possible that the extension is working as the author has intended, and therefore no 'fix' will ever be written for 'GitDoc isn't creating a commit on save'. However, it's not working as it is explained (at least in part of the documentation):

What the documentation says:

Auto-saving When you enable GitDoc, it creates a new commit anytime you save a file.

What I believe it should say:

Auto-saving When you enable GitDoc, it creates a new commit of saved files every 30 seconds. 30 seconds is the default Gitdoc: Auto Commit Delay.