Is there a Git filter to disable update the $:/StroyList and $:/temp/search div

129 views
Skip to first unread message

Cook Schelling

unread,
Aug 12, 2016, 6:12:41 AM8/12/16
to TiddlyWiki
I use Git to manage my TiddlyWiki files' versions. But after each use of TW, div like $:/StoryList, $:/temp/search will be updated. I don't want commit these changes to Git. Is there a Git filter to help me discard these changes?

Thanks.

Matthew Lauber

unread,
Aug 12, 2016, 8:26:03 AM8/12/16
to TiddlyWiki
Take a look at this:  https://help.github.com/articles/ignoring-files/

Basically, you can create a file titled .gitignore, and put the path of the files you want to ignore in it, and they will be ignored.  Be aware that if you've already committed those files once they won't be ignored going forwards unless you git rm them.

Matt

Danielo Rodríguez

unread,
Aug 13, 2016, 5:08:26 AM8/13/16
to TiddlyWiki
do you mean individual tid tiddlers or entire html files?

Cook Schelling

unread,
Aug 17, 2016, 3:39:00 AM8/17/16
to TiddlyWiki
I mean individual tid tiddlers.

Cook Schelling

unread,
Aug 17, 2016, 3:40:20 AM8/17/16
to TiddlyWiki
I don't want to ignore the tw file, I just want to filter out some tiddler's change.

Danielo Rodríguez

unread,
Aug 17, 2016, 3:50:54 AM8/17/16
to TiddlyWiki
Just ignore the tiddlers you don't want to track by including them in a file called .gitignore

Cook Schelling

unread,
Aug 17, 2016, 10:57:04 AM8/17/16
to TiddlyWiki
I know what .gitignore is. I don't want to ignore the whole tw file, I just want ignore some changes that are not caused directly by my edition. I think a git filter can resolve my question, so I want to know if there is also some resolution.

PMario

unread,
Aug 17, 2016, 4:08:13 PM8/17/16
to TiddlyWiki
On Wednesday, August 17, 2016 at 4:57:04 PM UTC+2, Cook Schelling wrote:
I know what .gitignore is. I don't want to ignore the whole tw file, I just want ignore some changes that are not caused directly by my edition. I think a git filter can resolve my question, so I want to know if there is also some resolution.

No. gitignore can only filter on a file basis. ...

Since you are talking about a <div>  that is changed, I think you push the whole tiddlywiki.html file. .. So the only thing that can prevent this is, that you change your "save-filter" in TW itself. The tiddler is $:/core/save/all
If you change it like the following code, it won't save eg: $:/StoryList, ... but there are a lot of other temporary tiddlers, that may be created while working with TW. So may need them to the "exclude" list.

WARNING! -> !!! Make a backup first !!!  If you mess up this tiddler you may end up with an empty or corrupted tiddlywiki!

\define saveTiddlerFilter()
[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] -[[$:/StoryList]] -[prefix[$:/temp/]] -[prefix[$:/state/]] $(publishFilter)$
\end
{{$:/
core/templates/tiddlywiki5.html}}


I did add the following -[[$:/StoryList]] -[prefix[$:/temp/]] -[prefix[$:/state/]]  elements to the above filter. It will prevent the story list and all tiddlers prefixed "$:/temp/" and "$:/state/". .. If you don't want this, just remove them. ... Just to be sure: Did I make clear that backups are important? ;)

There is a $(publishFilter)$ variable, which should make things easier,  but I don't know how to set it. @Jeremy can you help?

have fun!
mario
PS: A wise man said: Backups will prevent you from data loss! ;)

Cook Schelling

unread,
Aug 17, 2016, 9:51:41 PM8/17/16
to TiddlyWiki
Thank you very much, Mario.

BTW: By Git .gitattributes, it's possible to add a saving filter. You can refer to this example(https://github.com/kynan/nbstripout), a git filter for IPython notebook.
Reply all
Reply to author
Forward
0 new messages