Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Possibility to use committer as "From" in generated mails #31

Closed
rhertzog opened this Issue Jul 28, 2013 · 6 comments

Comments

Projects
None yet
4 participants
Contributor

rhertzog commented Jul 28, 2013

We have a limited set of committers and we like to see who commited directly in the "From" field. Please make it possible to use that identity in the From field ideally with a simple setting, otherwise at least with wrapper script.

Right now, it's not possible to override get_fromaddr() of the Environment because it doesn't get the details of the commit or from the changes.

Contributor

mhagger commented Jul 31, 2013

Does the "computed-from" branch that I just pushed do what you need? It changes the callers of get_fromaddr() to pass a Change instance to the method when one is available. You could override Environment.get_fromaddr() with code like

if isinstance(change, Revision):
    ....
elif isinstance(change, ReferenceChange):
    ....
else:
    # change can be None, too, if called when instantiating an SMTPMailer if environment.get_sender() does
    # not return a value; in that case you have to return something here, too.
Contributor

rhertzog commented Jul 31, 2013

Yes, looks like so. It would be even easier if Revision extracted the committer information too at the same time it takes care of the author.

I'm a git and git-multimail noob, and just noticed that some commit messages were marked as spam because of the completely made up FROM address. I would like to use the committer's address in FROM. How can I do that?

Never mind. I've found a hacky way of doing this by passing the user email in as an environment variable that is assigned the result of

$(git log -1 --format=format:%ae HEAD)

and then overriding get_fromaddr to use this. It's not nice, but it works.

@moy moy added the enhancement label Jun 16, 2015

Contributor

moy commented Jun 19, 2015

Fixed by #99.

@moy moy closed this Jun 19, 2015

This works great, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment