threads / discuss / 54081

gitignore does not ignore wildcard directory if it is a link

Subject: gitignore does not ignore wildcard directory if it is a link

## tl;dr

2 messages between Aug 21, 2020 and Aug 21, 2020.

replies: 1people: 2as markdown or json

voxspox· Aug 21, 2020, 13:37 UTC · lore
Hi,
I start with a scenario:
contents of working copy:

/somefile1 /test/dir1 (directory) /test/dir2 (link to directory) /test/dir3 (link to directory) /test/file1

I want to ignore all subfolders in "test", thus I modified my .gitignore to:
/test/*/
> git status
Untracked files:
  test/dir2
  test/dir3
Putting "/test/dir3" into .gitignore will work fine.

-> It seems that directories are not ignored by a wildcard pattern if the directory is a link using: 2.25.1 on Linux

regards Knut
Junio C Hamano· Aug 21, 2020, 16:46 UTC · re: voxspox · lore

Re: gitignore does not ignore wildcard directory if it is a link

voxspox <voxspox@gmx.net> writes:
Show 23 quoted lines
> /somefile1
> /test/dir1  (directory)
> /test/dir2  (link to directory)
> /test/dir3  (link to directory)
> /test/file1
>
> I want to ignore all subfolders in "test", thus I modified my .gitignore to:
>
> /test/*/
>
>
>> git status
>
> Untracked files:
>   test/dir2
>   test/dir3
>
>
> Putting "/test/dir3" into .gitignore will work fine.
>
>
> -> It seems that directories are not ignored by a wildcard pattern if
> the directory is a link

This is working as designed, intended and expected, I would think. Git does track symbolic links as the first-class citizen, and dir2 and dir3 in the above example are *not* directories.

← back to recent threads