On Sun, Sep 23, 2007 at 06:45:14PM +0200, Ralf S. Engelschall wrote:
On Sun, Sep 23, 2007, Nathaniel Smith wrote:
This is broken, unfortunately -- e.g., if the user starts a commit,
aborts it, then tries again, they will end up with multiple copies of
the template in their log message.
Really? I tried it multiple times and I aborted by just using ":q!"
from Vim and I never have seen the message accumulating. It worked just
fine. The Lua function intentionally just copies .mtn-message into the
_temporary_ file, not into _MTN/log.
Yes, but on a failed/aborted commit, monotone saves whatever was
written to the log message back into _MTN/log, so that when the user
tries again after fixing whatever problem they had, their log message
will pop back up. ...I don't know why that wasn't happening for you.
For that matter, I don't understand how doing ":q!" would have aborted
anything; it is supposed to abort only if the user has not written
anything to the log, and in this case, it looks exactly as if the user
*has* written something, i.e. whatever was in .mtn-message.
This of course is a bug, the "abort commit if log message is empty"
logic should be extended to "abort commit if log message is empty or
equal to .mtn-message", but I don't see this extension in the patch
you posted. ...Or maybe if we implemented things the way I suggest,
by copying .mtn-message into _MTN/log, then this wouldn't be
necessary, because having _MTN/log non-empty triggers the thing where
it wants you to confirm the commit by deleting a magic line. Dunno.
Anyway, I don't understand the behavior you describe at all.
What charset should .mtn-message be interpreted to be in, current user
preferred charset or always-utf8? Always-utf8 seems more viable,
though I'm sure it will bite someone at some point.
Can we control this in the Lua hook at all?
I don't think so, the charset conversion stuff could in principle be
exposed to lua, but IIRC it isn't ATM.
I think the right place to do this is in the core _MTN/log / commit
message handling code, though, as per above, and that code is already
perfectly smart about charsets.