FND/tiddlywebplugins.gitstore — pull request #11 by cdent (2013-03-26 17:33:08+00:00)
Title: Ensure call to git to get current revision has file arg

Otherwise we end up just having a revision of whatever the
last commit was. Which gets rather confusing.

The splits added in the test files are because of (from irc):

[4:56pm] cdent: your test to replicate pmario's problem fails on text store too
[4:56pm] FND: oh wow
[4:56pm] cdent: so it doesn't actually replicate pmario's problem
[4:56pm] FND: that's bad
[4:56pm] cdent: but it does, however, mean....something
[4:56pm] FND: (I knew there was more to it because disabling the ETag assertion still has another one fail further down)
[4:58pm] cdent: the tricky bit here, though, is that tiddler etags are complex:
[4:58pm] cdent: we expect the part after the ':' to often be different
[4:59pm] FND: yes, but not if the tiddler remained the same
[4:59pm] FND: thus my test?
[4:59pm] cdent: no
[4:59pm] cdent: when doing a non-idempotent action only the part of the etag before the ':' is validated
[5:00pm] cdent: so your test is showing the same behavior in gitstore and in text
[5:00pm] cdent: and it is weird behavior, but not broken behavior
[5:00pm] cdent: so I'm going to change your test so it is more aligned with reality
[5:01pm] cdent: and see where that gets me
[5:02pm] FND: alright then
[5:02pm] • FND doesn't really grok why the second part doesn't matter
[5:03pm] cdent: i'll explain later
[5:03pm] cdent: but basically it comes down to needing the etag to work in two contexts: one to validate revisions for editing, one for cache validation
[5:03pm] cdent: the latter half of the etag is for the second of those
[5:03pm] cdent: things like mime type have to be taken into account then
[5:04pm] cdent: but _can't_ be taken into account on the former
[5:04pm] cdent: which is super dumb
[5:04pm] FND: hrm

It turns out, actually that the test was replicating the problem
correctly, once it was properly reflecting reality. Then, with a
a bit of printing here and there to show where revisions were coming
from and inspecting the raw git log it was pretty straightforward to
see what was up:

[5:20pm] cdent: so, anyway, I know what's happening now, but not why
[5:20pm] FND: do tell
[5:21pm] cdent: when you do the delete the incoming etag is compared against a calculated etag for the same tiddler
[5:21pm] cdent: weirdly it is getting the wrong commit for the revision
[5:21pm] cdent: what it is getting the is the most recent commit hash
[5:21pm] cdent: so that ought to be relatively easy to chase
[5:21pm] FND: strange
[5:24pm] cdent: got it