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

[PATCH 3/3] git-multimail: Add stdout option to config

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

Add a stdout option to the config that is equivalent to the --stdout command line option. This allows for easier debugging for a hook

Signed-off-by: Dave Boutcher <daveboutcher@gmail.com>
---
 git-multimail/README           |  5 +++++
 git-multimail/git_multimail.py | 10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/git-multimail/README b/git-multimail/README
index 49e0937..0235b83 100644
--- a/git-multimail/README
+++ b/git-multimail/README
@@ -400,6 +400,11 @@ multimailhook.quiet
 
     Do not output the list of email recipients from the hook
 
+multimailhook.stdout
+
+    For debugging, send emails to stdout rather than to the
+    mailer.  Equivalent to the --stdout command line option
+
 Email filtering aids
 --------------------
 
diff --git a/git-multimail/git_multimail.py b/git-multimail/git_multimail.py
index 095110a..35a1140 100755
--- a/git-multimail/git_multimail.py
+++ b/git-multimail/git_multimail.py
@@ -1585,6 +1585,9 @@ class Environment(object):
         quiet (bool)
             On success do not write to stderr
 
+        stdout (bool)
+            Write email to stdout rather than emailing. Useful for debugging
+
     """
 
     REPO_NAME_RE = re.compile(r'^(?P<name>.+?)(?:\.git)$')
@@ -1598,6 +1601,7 @@ class Environment(object):
         self.refchange_showlog = False
         self.commitlogopts = ['-C', '--stat', '-p', '--cc']
         self.quiet = False
+        self.stdout = False
 
         self.COMPUTED_KEYS = [
             'administrator',
@@ -1753,6 +1757,10 @@ class ConfigOptionsEnvironmentMixin(ConfigEnvironmentMixin):
             'quiet', default=False
             )
 
+        self.stdout = config.get_bool(
+            'stdout', default=False
+            )
+
         maxcommitemails = config.get('maxcommitemails')
         if maxcommitemails is not None:
             try:
@@ -2563,7 +2571,7 @@ def main(args):
                 sys.stderr.write('    %s : %r\n' % (k, v))
             sys.stderr.write('\n')
 
-        if options.stdout:
+        if options.stdout or environment.stdout:
             mailer = OutputMailer(sys.stdout)
         else:
             mailer = choose_mailer(config, environment)
-- 
2.3.0
Previous: Dave BoutcherNext: Michael Haggerty
Message 3 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.