git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* temporarily unsetting sendemail.smtpuser
@ 2010-05-19 22:54 Eric Blake
  2010-05-20  8:23 ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Blake @ 2010-05-19 22:54 UTC (permalink / raw)
  To: Git Mailing List

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: temporarily unsetting sendemail.smtpuser
  2010-05-19 22:54 temporarily unsetting sendemail.smtpuser Eric Blake
@ 2010-05-20  8:23 ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 2+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-05-20  8:23 UTC (permalink / raw)
  To: Eric Blake; +Cc: Git Mailing List

On Wed, May 19, 2010 at 22:54, Eric Blake <eblake@redhat.com> wrote:
> But both of those are rather unappealing.  Is there a better approach to
> accomplishing what I wanted?

--no-smtp-user ?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-20  8:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-19 22:54 temporarily unsetting sendemail.smtpuser Eric Blake
2010-05-20  8:23 ` Ævar Arnfjörð Bjarmason

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).