git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] git-multimail: Add a quiet option to prevent outputting email addresses from hook

From
Dave Boutcher <daveboutcher@gmail.com>
Date
Apr 21, 2015, 23:04 UTC
Message-ID
<1429657487-10809-2-git-send-email-daveboutcher@gmail.com>
In-Reply-To
<1429657487-10809-1-git-send-email-daveboutcher@gmail.com>

We have a very log list of recipients...displaying that list on every push is annoying

Add an option to prevent printing the list of email addresses from the hook

Signed-off-by: Dave Boutcher <daveboutcher@gmail.com>
---
 git-multimail/README           |  3 +++
 git-multimail/git_multimail.py | 11 ++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/git-multimail/README b/git-multimail/README
index a40847a..49e0937 100644
--- a/git-multimail/README
+++ b/git-multimail/README
@@ -396,6 +396,9 @@ multimailhook.replyToRefchange
     - The value "none", in which case the Reply-To: field will be
       omitted.
 
+multimailhook.quiet
+
+    Do not output the list of email recipients from the hook
 
 Email filtering aids
 --------------------
diff --git a/git-multimail/git_multimail.py b/git-multimail/git_multimail.py
index 5ed253f..095110a 100755
--- a/git-multimail/git_multimail.py
+++ b/git-multimail/git_multimail.py
@@ -1582,6 +1582,9 @@ class Environment(object):
             commit mail.  The value should be a list of strings
             representing words to be passed to the command.
 
+        quiet (bool)
+            On success do not write to stderr
+
     """
 
     REPO_NAME_RE = re.compile(r'^(?P<name>.+?)(?:\.git)$')
@@ -1594,6 +1597,7 @@ class Environment(object):
         self.logopts = []
         self.refchange_showlog = False
         self.commitlogopts = ['-C', '--stat', '-p', '--cc']
+        self.quiet = False
 
         self.COMPUTED_KEYS = [
             'administrator',
@@ -1745,6 +1749,10 @@ class ConfigOptionsEnvironmentMixin(ConfigEnvironmentMixin):
             'refchangeshowlog', default=self.refchange_showlog
             )
 
+        self.quiet = config.get_bool(
+            'quiet', default=False
+            )
+
         maxcommitemails = config.get('maxcommitemails')
         if maxcommitemails is not None:
             try:
@@ -2376,7 +2384,8 @@ class Push(object):
                     % (change.refname, change.old.sha1, change.new.sha1,)
                     )
             else:
-                sys.stderr.write('Sending notification emails to: %s\n' % (change.recipients,))
+                if not self.environment.quiet:
+                    sys.stderr.write('Sending notification emails to: %s\n' % (change.recipients,))
                 extra_values = {'send_date': send_date.next()}
                 mailer.send(
                     change.generate_email(self, body_filter, extra_values),
-- 
2.3.0
Previous: Dave BoutcherNext: Dave Boutcher
Message 2 of 7 in “git-multimail: Add an option to filter on branches”
  1. 1/3 git-multimail: Add an option to filter on branchesDave Boutcher, Apr 21, 2015
  2. 2/3 git-multimail: Add a quiet option to prevent outputting email addresses from hookDave Boutcher, Apr 21, 2015
  3. 3/3 git-multimail: Add stdout option to configDave Boutcher, Apr 21, 2015
  4. Michael HaggertyApr 22, 2015
  5. Dave BoutcherApr 22, 2015
  6. Michael HaggertyApr 22, 2015
  7. Dave BoutcherApr 23, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.