stefanha / git-publish

Prepare and store patch revisions as git tags
MIT License
133 stars 35 forks source link

blurb post-processing ? #61

Open jnsnow opened 5 years ago

jnsnow commented 5 years ago

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.

stefanha commented 5 years ago

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.

danilocesar commented 5 years ago

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 commented 5 years ago

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?

stefanha commented 5 years ago

Yes, sounds good!