From: Eric Blake <eblake@redhat.com>
To: Git Mailing List <git@vger.kernel.org>
Subject: temporarily unsetting sendemail.smtpuser
Date: Wed, 19 May 2010 16:54:02 -0600 [thread overview]
Message-ID: <4BF46C0A.9070000@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1717 bytes --]
I have a setup where I normally send patches through my ISP, which
requires authentication, so I have sendemail.smtpuser=me and
sendemail.smtpserverport=587 set in my ~/.gitconfig (among others). But
for one project I work on, I am required to send patches through an
alternate SMTP server that does not require authentication.
At first, I thought it would be a simple matter to use git config to
create an alias, where the explicit command line requests would override
the global ~/.gitconfig settings:
[alias]
submit = send-email --smtp-user= --smtp-server=alternate \
--smtp-server-port=25
But that fails with:
$ git submit -1
fatal: unrecognized argument: --smtp-user=
format-patch -o /tmp/JgTFO8Rq3v -1 --smtp-user=: command returned error: 128
In other words, git-send-email didn't recognize the empty --smtp-user=
command as an override request, and instead passed it on to
git-format-patch which croaks.
So I ended up creating this hairy alias instead:
[alias]
submit = "!sh -c 'git config --global --unset sendemail.smtpuser; git
send-email --smtp-server=alternate --smtp-server-port=25 \"$@\"; st=$?;
git config --global sendemail.smtpuser me; (exit $st)' sh"
I suppose I could have used a shell function for fewer forks:
[alias]
submit = "!doit() { git config --global --unset sendemail.smtpuser; git
send-email --smtp-server=alternate --smtp-server-port=25 \"$@\"; st=$?;
git config --global sendemail.smtpuser me; return $st; }; doit"
But both of those are rather unappealing. Is there a better approach to
accomplishing what I wanted?
--
Eric Blake eblake@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
next reply other threads:[~2010-05-19 22:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-19 22:54 Eric Blake [this message]
2010-05-20 8:23 ` temporarily unsetting sendemail.smtpuser Ævar Arnfjörð Bjarmason
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=4BF46C0A.9070000@redhat.com \
--to=eblake@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).