Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding an option to not state the branch name in the subject line #27

Open
stas00 opened this issue Sep 28, 2018 · 6 comments
Open

adding an option to not state the branch name in the subject line #27

stas00 opened this issue Sep 28, 2018 · 6 comments

Comments

@stas00
Copy link
Contributor

stas00 commented Sep 28, 2018

Given, that my git-notifier setup is configured to report only on the master branch, it's redundant to add master to every subject line, as it eats up valuable space. At the moment I removed that with:

- subject = "%s: %s" % (subject_head, subject[0])
+ subject = subject[0]

I think it might be useful to others as well as a feature. So perhaps git-notifier could have a new flag, something like: -emailprefixincludebranch true/false and exclude branch name if false?

I don't know enough about git-notifier's logic to know whether I'm not losing some other bits when I exclude subject_head. But otherwise it'd look something like:

Options = [
    ("emailprefixincludebranch", True, True, "Include branch name in the subject"),
[...]
if self.emailprefixincludebranch:
    subject = "%s: %s" % (subject_head, subject[0])
else:
    subject = subject[0]

This is untested.

@rsmmr
Copy link
Owner

rsmmr commented Sep 29, 2018

That patch should work, but it may be worth generalizing this a bit to make the subject generally configurable and then also replace the emailprefix option. E.g., mailsubject=[git/${repo}] ${heads}: ${msg} to replicate the default.

@stas00
Copy link
Contributor Author

stas00 commented Sep 29, 2018

Your suggestion is a more elegant solution, Robin. Thank you.

I will just need to make sure that none of these get expanded/mangled on gitdub's-side which I use to drive git-notifier for real-time github diff emails.

And while we are at it, do you think ${head} is intuitive? won't ${branch} be clearer?

And that's why I was asking whether there was potentially more to head, than just branch name.

@rsmmr
Copy link
Owner

rsmmr commented Sep 29, 2018

It's kind of the same, head is just the internal git terminology and technically a bit broader in meaning than branch (to me, at least :-). But I don't really mind. Note that it should be plural though: it can be more than one branch, git-notifier comma-separates them in that case.

@stas00
Copy link
Contributor Author

stas00 commented Sep 29, 2018

head is fine then, now that i know what it means.

wrt, plural - I don't follow you on this one. While git-notifier can be configured to watch multiple branches, a single email is always about a single branch, so how can it be plural?

@rsmmr
Copy link
Owner

rsmmr commented Sep 30, 2018

No, a single email can refer to multiple branches. An email is per commit. If at the time git-notifier runs a new commit has become part of multiple branches already, the mail will show all corresponding heads.

@stas00
Copy link
Contributor Author

stas00 commented Sep 30, 2018

Thank you for explaining that, Robin, I thought an email only ever refers to a single branch. So ${heads} it is then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants