gitdoc icon indicating copy to clipboard operation
gitdoc copied to clipboard

GitDoc isn't creating a commit on save

Open tompaton opened this issue 2 years ago • 6 comments

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.

tompaton avatar Jul 28 '23 12:07 tompaton

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.

lostintangent avatar Jul 28 '23 15:07 lostintangent

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

tompaton avatar Jul 29 '23 10:07 tompaton

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

lostintangent avatar Jul 29 '23 14:07 lostintangent

Waiting for this support.

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

arulrajnet avatar Aug 26 '23 05:08 arulrajnet

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

thesobercoder avatar Dec 07 '23 11:12 thesobercoder

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.

JackFinnZinc avatar Jan 11 '24 16:01 JackFinnZinc

Closing this along with #63, since we just merged support for multi root workspaces

lostintangent avatar Aug 07 '25 15:08 lostintangent