git-publish icon indicating copy to clipboard operation
git-publish copied to clipboard

blurb post-processing ?

Open jnsnow opened this issue 6 years ago • 4 comments

It might be nice to allow for a meta-language in blurbs that facilitate a primitive post-processing.

For example,

*** YOUR BLURB HERE ***

Could be something like this:

YOUR COVER LETTER HERE

{diffstat}

Where {diffstat} invokes a hook to perform some known action (like git-backport-diff -r '@{u}..' -u my-topic-v{N-1}) and replaces that section with the output from the hook.

When editing the blurb, you'd leave {diffstat} in to allow it to be populated when sending, but not saved for future versions.

In the past, I've also scripted appending things like "And here's where this git branch is mirrored on github, for convenience" that could also take the form of another templating hook.

jnsnow avatar Sep 05 '19 02:09 jnsnow

Nice idea. A very simple solution is to turn the template into a hook script that outputs a template. Then the script can do anything to generate a dynamic template.

stefanha avatar Sep 05 '19 13:09 stefanha

So this would work like a "git sendemail-validate hook", allowing changes in the message, but only for the cover letter?

we could, for example, validate metadata in the message? I know some folks that are really interested in such a feature =)

danilocesar avatar Oct 24 '19 23:10 danilocesar

Something like: define a "process-cover-letter-script = some-script.py" in .gitpublish

then invoke 'some-script.py' if it's defined, before sending the email. The script could be customized to do whatever it wants, like replace {diffstat} by the contents (git-backport-diff -r '@{u}..' -u my-topic-v{N-1}), or even check if the information in the cover letter contains everything that a certain bot expects?

danilocesar avatar Oct 25 '19 00:10 danilocesar

Yes, sounds good!

stefanha avatar Oct 29 '19 15:10 stefanha