All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: git@vger.kernel.org, Catalin Marinas <catalin.marinas@gmail.com>
Subject: [PATCH 2/2] Don't require config file for "stg mail"
Date: Tue, 28 Nov 2006 22:59:30 -0500	[thread overview]
Message-ID: <20061129035930.6118.88435.stgit@dv.roinet.com> (raw)
In-Reply-To: <20061129035925.6118.78329.stgit@dv.roinet.com>

When calculating the string to be used in the From: field, don't require
it to come from the configuration file.  Instead, reuse already known
authname and authemail values as the default.  They can be taken from
the GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL environment variables.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 stgit/commands/mail.py |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py
index 176d7a2..70b091f 100644
--- a/stgit/commands/mail.py
+++ b/stgit/commands/mail.py
@@ -122,18 +122,13 @@ options = [make_option('-a', '--all',
                        action = 'store_true')]
 
 
-def __get_sender():
-    """Return the 'authname <authemail>' string as read from the
-    configuration file
+def __get_sender(authname, authemail):
+    """Return the string to be used in the From: field
     """
     if config.has_option('stgit', 'sender'):
         return config.get('stgit', 'sender')
-    elif config.has_option('stgit', 'authname') \
-             and config.has_option('stgit', 'authemail'):
-        return '%s <%s>' % (config.get('stgit', 'authname'),
-                            config.get('stgit', 'authemail'))
     else:
-        raise CmdException, 'unknown sender details'
+        return '%s <%s>' % (authname, authemail)
 
 def __parse_addresses(addresses):
     """Return a two elements tuple: (from, [to])
@@ -298,7 +293,7 @@ def __edit_message(msg):
 def __build_cover(tmpl, total_nr, msg_id, options):
     """Build the cover message (series description) to be sent via SMTP
     """
-    sender = __get_sender()
+    sender = __get_sender(authname, authemail)
 
     if options.version:
         version_str = ' %s' % options.version
@@ -372,7 +367,7 @@ def __build_message(tmpl, patch, patch_nr, total_nr, msg_id, ref_id, options):
     commname = p.get_commname();
     commemail = p.get_commemail();
 
-    sender = __get_sender()
+    sender = __get_sender(authname, authemail)
 
     fromauth = '%s <%s>' % (authname, authemail)
     if fromauth != sender:

  reply	other threads:[~2006-11-29  3:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-29  3:59 [PATCH 1/2] Set HOME to the test directory to avoid reading ~/.stgitrc Pavel Roskin
2006-11-29  3:59 ` Pavel Roskin [this message]
2006-11-29 16:29   ` [PATCH 2/2] Don't require config file for "stg mail" Catalin Marinas
2006-11-29 23:27     ` Pavel Roskin
2006-11-30  8:32       ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061129035930.6118.88435.stgit@dv.roinet.com \
    --to=proski@gnu.org \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.