Git as syncadapter

107 views
Skip to first unread message

ar...@menedev.de

unread,
Jun 27, 2020, 8:55:13 AM6/27/20
to TiddlyWiki
I'm currently trying to figure out which hosting options suite my needs best.

My current take is running TiddlyWiki on Node, however I would love to do more than just saving to the filesystem. Almost everything I do is backed by git anyway, so I see a lot of value in syncing those files to git. At the same time I want my server to remain responsive. Easiest would be to run a cron job that does a commit and push every few seconds, but I wonder if a syncadapter would be more elegant. From what I've read there can only be one syncadapter, so saving to filesystem and git would probably require a new syncadapter that merges the functionality from the filesystem syncadapter and github saver. Though being on node we have more options like nodeGit or https://isomorphic-git.org/.
I would use git only for backup and versioning, so not looking for changes, just force-pushing.

What do you think? Is a syncadapter for fs+git a good idea? Am I missing something that would give that capability already?


Greetings
Mene

PMario

unread,
Jun 27, 2020, 11:23:52 AM6/27/20
to TiddlyWiki
Hi Mene,

I'd go with the cron-job, to trigger git add and git commit. ... eg: You could create a "special tiddler" named commit.txt, with a commit message.

The cron job can scan for this tiddler.
If the cron job finds this tiddler it takes the text and removes the commit.txt and commit.txt.meta from the directory and
triggers the git actions.

This way you can easily create git commits only if you are sure, that your stuff is valid. ... If the sync adapter will trigger every change you make, you'll have a lot of "temporary" content being part of your git repo.

just my thoughts
mario

PMario

unread,
Jun 27, 2020, 11:25:35 AM6/27/20
to TiddlyWiki
Hi,

using .gitignore will enable you to "remove" temp tiddlers from a commit, if you want to

-m

Saq Imtiaz

unread,
Jun 27, 2020, 5:33:26 PM6/27/20
to TiddlyWiki
Michael: I use a Cron script. I don't see the advantage of a git adapter unless you plan to add the ability to revert changes from within TiddlyWiki.

Riz

unread,
Jun 27, 2020, 11:37:52 PM6/27/20
to TiddlyWiki
A separate file watcher would be a low key solution. Watch a specific Tiddler and trigger commit if content changes

It would be interesting to see if webserver API can be extended to create an endpoint to do this.

Rob Hoelz

unread,
Jun 28, 2020, 5:30:53 PM6/28/20
to TiddlyWiki
Hello there!

I have a friend who uses a program called modd to accomplish this - that's one way to do it!

When he and I were talking about Git integration with TiddlyWiki, I offered the idea of adding an event listener for the "change" event on the Node side, and then doing git-add + git-commit after the filesystem plugin had finished writing the tiddler out to disk.  That's another approach you might want to consider!

-Rob

Lin Onetwo

unread,
Jun 29, 2020, 2:26:23 AM6/29/20
to TiddlyWiki
Hi,

There are also scripts to start TiddlyWiki on start-up.

But... you can see it ruined my GitHub commit timelineScreen Shot 2020-06-29 at 2.25.35 PM.png
Reply all
Reply to author
Forward
0 new messages