3

This is so confusing. It is easier to show using the shell commands.

Note that my ~/.gitconfig specifies excludesfile = /home/I063510/.gitignore in section [core]

check why .p12 is ignored, pipe to sed to mask my user id

$> git check-ignore -v check.p12 | sed -n 's,/home/[^/]*,~,p'
~/.gitignore:11:*.war   check.p12

comment out the line with pattern ^*.war and verify the .p12 file is not ignored now

$> sed -i.orig 's,^*.war,#&,' ~/.gitignore
$> git check-ignore -v check.p12 | sed -n 's,/home/[^/]*,~,p'
$> 

restore original file and verify .p12 is ignored

$> mv -f ~/.gitignore.orig ~/.gitignore
$> git check-ignore -v check.p12 | sed -n 's,/home/[^/]*,~,p'
~/.gitignore:11:*.war   check.p12

git version:

$> git --version
git version 2.17.0

UPDATE

I tried portablegit based on VonC's answer and see the same result:

# git check-ignore -v check.p12

# git config core.excludesfile c:/temp/.gitignore

# git check-ignore -v check.p12
c:/temp/.gitignore:1:*.war      check.p12

# git --version
git version 2.20.1.windows.1

UPDATE 2 Forgot to mention, this happens only for the pattern in ~core.excludesfile~, not in ~core.workdir~/.gitignore

Miserable Variable
  • 28,432
  • 15
  • 72
  • 133
  • That's definitely weird. You might download the Git source, build it for your machine, and try debugging the glob matching code. – torek Jan 09 '19 at 02:06
  • @torek I am using cygwin git. I do not have their gcc compiler. I guess I can download it but I suspect the cygwin build may need some special attention. – Miserable Variable Jan 09 '19 at 02:51
  • Very weird. Can't reproduce with `git version 2.13.2.556.g5116f79` on Centos 7.4.1708. – 0x5453 Jan 09 '19 at 23:07
  • Isn't your "update 2" in contradiction with your question title? – VonC Jan 10 '19 at 08:43
  • @VonC Indeed it is. When I posted this first I had forgotten that `~/.gitignore` is not a fixed path but rather _any_ file specified in `core.excludesfile`, either using `git config` or in `~/.gitconfig` – Miserable Variable Jan 10 '19 at 17:34
  • @0x5453 I can reproduce with PortableGit version 2.13.2.windows.1 on Windows 10 – Miserable Variable Jan 10 '19 at 18:54

1 Answers1

0

I am using cygwin git

Try and use the regular Git for Windows (PortableGit-2.20.1-64-bit.7z.exe), uncompress in C:\Git, and with a simplified PATH in a CMD session:

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%

Then you can type bash if you want to work in a bash session.
See if the issue persists then.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I see the same behavior. This happens whether I specify the path to .`gitignore` in `%WINHOME%\.gitconfig` or by using `git config core.excludesfile`, and irrespective of the actual location of the ignore file. I have updated my question with the interaction, for better formatting – Miserable Variable Jan 09 '19 at 22:52