HI all,
I am trying to get the Git plugin set up and running. it looks like it works fine when i run the command Git: sync, but trying to set the settings of
git:
autoCommitMinutes: 5
autoSync: true
in my SETTINGS file do not seem to be doing anything. I dont see any useful logs in the container relating to this. no indication that it is trying nor failing.
I did see someone suggest making a script-space to auto commit on save, which seems good enough, but they didnt share their code: Backup your space to Github - #4 by vuau
silverbullet.registerEventListener({name: "editor:pageSaved"}, async (event) => {
// Clear the existing timeout if the function is called again before the delay
if (debounceTimeout) {
clearTimeout(debounceTimeout);
}
// Set a new timeout
debounceTimeout = setTimeout(async () => {
try {
// Invoke the git sync command
await system.invokeFunction("git.syncCommand");
console.log("Git sync command executed successfully.");
} catch (error) {
console.error("Failed to execute Git sync command:", error);
}
}, 60000 * 5); // 5 minute delay
});