SZHG3ADNBW5WHINPGSDS4WTCZBJHETOZ7PO3YFF2EZKSQJOQF3GQC
Did I do something wrong with the patch message? pijul log
shows newlines properly, but they got squashed in the Nest display.
There’s a separate description
field in the change format, it’s not emitted by default unfortunately so you have to add it manually.
message = 'Add a config option for the patch message template'
description = '''Contents of field `message_skeleton` at the root of the global config file will be placed into `message` by `pijul record` for editing, if present and not overridden via `-m` switch.
Analogous to git's `commit.template`, but as an inline string rather than a filepath.
Moved the call to `Global::load` to a `lazy_static`. `header` needs the config in two places now, and parsing it twice seems like a waste. Arranging a single parse manually in a satisfying way (in both places it's a fallback, and should remain one) makes the function a mess.'''
It should look like that.
I see. Thank you! I will update the patch this evening to use this field instead (the code and the patch description).
EWCZA36LQWVX3TW3YSX4UH7PT54OYWC5OSIYE6LPH473AIYR3FKQC
Should the option contain the template inline (currently does) or point to a file with one?
I vote for the file.
There’s a separate description field in the change format
Wat? I was creating multi-lines message the whole time. BTW it took me some times to figure out how! (triple quotes).
If it is meant to be the summary only, the field should be named so (or title
) and description should be there by default (with the triple quotes).
You could even nudge people: if no template set, the default would be:
description = '''
Why is this change necessary?
How does it address the issue?
What side effects does this change have?
(or maybe as a comment rather than injected in the description, which is a bit intrusive).
See https://thoughtbot.com/blog/5-useful-tips-for-a-better-commit-message
Also, the same template file could be shared by git and pijul, coudn’t it?
I didn’t think about it, this would be quite nice. It might be somewhat awkward if the git template also sets the summary, not just the body of the description - pijul could either parse the single file into message
and description
(care needs to be taken to allow title-less templates) or dump the shared file into description
only (along with the summary, if any). But I’m not sure how often people use templates (and would want to) for the summary and how much of a problem that would be. Regardless, a file does sound better.
TFPETWTVADLG2DL7WERHJPGMJVOY4WOKCRWB3NZ3YOOQ4CVAUHBAC
Regarding
You could even nudge people: if no template set, the default would be … (or maybe as a comment rather than injected in the description, which is a bit intrusive).
I’ve tried writing this up last night, but failed. The comment needs to be inserted into the middle of the write in libpijul/src/change/text_changes.rs
, otherwise it ends up attached to the [[authors]]
subsection. I’m not sure if the serializer even supports this.
Sorry for the slow reply, I just found the time to apply this. Very cool patch, thank you very much!
Btw, I’m closing because there’s nothing for me to do just now, but you can keep pushing changes if you want (and possibly reopen).
The attached patch allows prepopulating
message
duringpijul record
from an option in the global config file. Similar to git’scommit.template
.Questions:
lazy_static
fromrecord
module to theconfig
, so other modules can use it if they want to? Is it even needed? I’ve added it pretty much out of laziness (no pun intended).message: ...
as-is or movemessage
to a separate variable, likeauthors
? It’s a bit on the cumbersome side.