Re: git 2.34.0: Behavior of `**` in gitignore is different from previous versions.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 18, 2021 at 08:11:04PM +0330, Danial Alihosseini wrote:

> What did you do before the bug happened? (Steps to reproduce your issue)
> Consider the following project structure
> - data
>   - data1
>     - file1
>     - file1.txt
>   - data2
>     - file2
>     - file2.txt
> - .gitignore
> 
> 
> `.gitignore` is as follows:
> ```
> data/**
> !data/**/
> !data/**/*.txt
> ```
> What did you expect to happen? (Expected behavior)
> 
> I expect all files in `data` folder to be ignored except `.txt` files.
> 
> What happened instead? (Actual behavior)
> 
> `file1` and `file2` are not ignored.
> Here is the `check-ignore` output:
> ```
> $ git check-ignore -v data/data1/file1
> .gitignore:2:!/data/**/ data/data1/file1
> ```

Thanks for an easy reproduction. It looks like this changed in
f6526728f9 (dir: select directories correctly, 2021-09-24). Author cc'd.

The key thing seems to be that the second line of your .gitignore should
match only directories (because of the trailing slash), but no longer
does.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux