From: Phillip Wood Date: Mon, 07 Feb 2022 14:05:16 GMT Subject: Re: git-checkout doesn't seem to respect config from include.path Message-ID: In-Reply-To: <3f1972f3-c764-41e9-9853-8f1c303d4f6b@beta.fastmail.com> Hi Greg On 03/02/2022 17:39, Greg Hurrell wrote: > On Thu, Feb 3, 2022, at 4:54 PM, Phillip Wood wrote: >> Hi Greg >> >> On 02/02/2022 16:04, Greg Hurrell wrote: >> >>> `git config --get merge.conflictStyle` correctly reports that my setting is >>> "diff3" on such machines, and `git config --get-all merge.conflictStyle` >>> shows: >>> >>> diff3 >>> zdiff3 >>> >>> In other words, it knows that I have multiple values set, but it uses >>> a last-one-wins policy. >>> >>> However, when I try to run a command like `git checkout -b something`, >>> Git dies with: >>> >>> fatal: unknown style 'zdiff3' given for 'merge.conflictstyle' >> >> I think what is happening is that git parses each line of the config >> file as it reads it so the old version of git sees "zdiff3" and errors >> out before it reads the include line. > > That gave me the idea of moving the `include.path` setting higher up in > the file, to see if `git checkout` would consult that value first, but > it doesn't work; `git config merge.conflictStyle` shows the value from > the file indicated in `include.path`, but a command like `git checkout` > still dies based on the value in ~/.gitconfig. Yes, you need to move the "zdiff3" setting into an include file that is only read by recent versions of git. > Overall this points to the general problem that it is not only hard to > make a single config that works on different machines, but it's hard to > make a _combination_ of files that works on different machines. If you make sure that you are only including files containing recent config keys on machines running recent git versions then it should work but arranging for that to happen is not necessarily easy Best Wishes Phillip > For now, I think my workaround is going to be templating out > machine-specific files. > > Greg >