git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-send-email does not use conditional configuration

From
KDKonstantinos Dalamagkidis <konstantinos@dalamagkidis.info>
Date
Sep 11, 2019, 16:58 UTC
Message-ID
<d4717b7f-b7a4-208b-6b83-7993b6bd7886@dalamagkidis.info>
In-Reply-To
<20190911140833.GA13916@sigill.intra.peff.net>
On 9/11/19 4:08 PM, Jeff King wrote:
Show 21 quoted lines
> On Wed, Sep 11, 2019 at 08:14:45AM +0200, Konstantinos Dalamagkidis wrote:
> 
>> In my git configuration, I have an includeif section for work
>> related repositories that configures the user and sendemail
>> sections.
> 
> What kind of includeIf are you using? Does it work with an
> unconditional include? This seems to work for me:
> 
>    $ git config --global include.path one
>    $ git config --file ~/one sendemail.smtpserver one.example.com
>    $ git send-email --dry-run -1 --to nobody | grep ^Server
>    Server: one.example.com
> 
>    $ git config --global includeIf.gitdir:$PWD/.path two
>    $ git config --file ~/two sendemail.smtpserver two.example.com
>    $ git send-email --dry-run -1 --to nobody | grep ^Server
>    Server: two.example.com
> 
> I.e. both unconditional and gitdir includes work for me. If you do
> something similar, what output do you get?

I am using "includeIf.gitdir:/work". I tried to reproduce it at my home workstation where I have the exact same configuration, but in the beginning I couldn't. Then I realized, that at work the /work folder is actually a symlink to a different directory. When I did the same at home, I could reproduce the issue:

% pwd
/work/repo
% git send-email --dry-run -1 --to nobody | grep ^From
From: Konstantinos Dalamagkidis <work-email@example.com>
% cd ../repo-symlink
% git send-email --dry-run -1 --to nobody | grep ^From
From: Konstantinos Dalamagkidis <personal-email@example.com>
% realpath .
/home/dalamagkidis/tmp/repo

It appears that git-config and git-send-email parse the gitdir slightly differently when it comes to symlinks. More specifically git-send-email uses the realpath of the repository to determine which configuration to use. It also explains why nobody came across this problem before.

Rgds Konstantinos

Previous: Jeff KingNext: Jeff King
Message 3 of 4 in “git-send-email does not use conditional configuration”
  1. Konstantinos DalamagkidisSep 11, 2019
  2. Jeff KingSep 11, 2019
  3. Konstantinos DalamagkidisSep 11, 2019
  4. Git.pm normalizes $GIT_DIR, was Re: git-send-email does not use conditional configurationJeff King, Sep 11, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.