On Wed, May 03, 2023 at 03:53:57PM -0400, Hugo Villeneuve wrote:

[...]
> > > I have a global git settings in /etc/git/config that I use for most of
> > > my projects:
> > > 
> > > [sendemail]
> > >          smtpUser = my-username
> > >          smtpServer = mail.my-server.com
> > >          smtpServerPort = 2525
> > >          tocmd ="`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback
> > > --norolestats --nol"
> > >          cccmd ="`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback
> > > --norolestats --nom"
> > > 
> > > However, for a particular project, I must use a different sendemail
> > > configuration. I have added this to my .git/config file in this
> > > project:
> > > 
> > > [sendemail]
> > >          smtpServer = alternate-mail-server.com
> > > 
> > > For this, I do not want to use the global entries like smtpUser,
> > > tocmd, etc. Unfortunately, these entries are set to the default value
> > > in /etc/config.
> > 
> > Yes, but you could explicitly set them to empty strings in your
> > project's .git/config.
> 
> Hi Tassilo,
> no, I tried it and it doesn't work.
> 
> Setting an entry to an empty string is not the same as having this entry
> "not defined" for some applications.
> 
> For example, if you look at the git sendemail source code, you will see take
> a different action is taken depending if the "tocmd" entry is undefined or
> is set to an empty string.
[...]

The git-send-email manual page [1] mentions the possibility of having named
"identities" for sending mail - the sendemail.identity configuration variable
and the "namespaced" settings «sendemail.<identity>.*».

Wouldn't it be possible to (ab)use this mechainsm in the following way:

 * In the global configuration, have the default settings in a named
   identity, as well as having the sendemail.identity set to the name of that
   identity - something like

     sendemail.default.smtpUser = my-username
     ...
     sendemail.identity = default

 * The local configuration might possibly be just left as is or, if that does
   not work, you could define it in a way similar to the global one, but
   involving a differently-named identity - such as "local".

Please note that I do not even have git-send-email installed, so all of the
above is plain guessing.

 1. https://git-scm.com/docs/git-send-email

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/20230504145917.66tr7sdmv2fgj237%40carbon.

Reply via email to