On 5/3/23 15:15, Tassilo Horn wrote:
Hugo Villeneuve <gob...@gmail.com> writes:

Hi Hugo,

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.

Is it possible in a local .git/config to unset/delete an entry?

I've tried "git config --local --unset some.option" which actually only
deletes the some.option if it is there.  It does not add an entry with
empty value to override what's in some less specific git config.  For
that, you can do "git config --local some.option ''", i.e., pass the
empty string value yourself.

With your example, you could write something like

--8<---------------cut here---------------start------------->8---
[sendemail]
          smtpServer = alternate-mail-server.com
          smtpUser =
          smtpServerPort =
          tocmd =
          cccmd =
--8<---------------cut here---------------end--------------->8---

I do NOT want to use an external command like 'git config' to do it.

Why?  And why "external"?  I cheated and used this command to figure out
what exactly I would need to write in the git config file.

Because I don't want to run a script each time I want to call git sendmail.

Hugo.

--
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 git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/6dd8abbd-694f-adf6-bbf2-2ba2e0d76a6e%40gmail.com.

Reply via email to