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

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

From
DADanial Alihosseini <danial.alihosseini@gmail.com>
Date
Nov 18, 2021, 16:41 UTC
Message-ID
<CACLOEFZz7bunO2S5-ec1K10B9AJU4-m50j3j9c=12R6d1D+-dg@mail.gmail.com>

Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.

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 ```

What's different between what you expected and what actually happened? It seems that the behavior of `**` in gitignore is different from previous versions.

Anything else you want to add:

Please review the rest of the bug report below. You can delete any lines you don't wish to share.

[System Info] git version: git version 2.34.0 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 5.15.2-arch1-1 compiler info: gnuc: 11.1 libc info: glibc: 2.33 $SHELL (typically, interactive shell): /usr/bin/zsh

[Enabled Hooks]
Next: Jeff King
Message 1 of 13 in “git 2.34.0: Behavior of `**` in gitignore is different from previous versions.”
  1. Danial AlihosseiniNov 18, 2021
  2. Jeff KingNov 18, 2021
  3. Derrick StoleeNov 18, 2021
  4. Danial AlihosseiniNov 19, 2021
  5. Derrick StoleeNov 19, 2021
  6. Danial AlihosseiniNov 19, 2021
  7. Johannes SixtNov 19, 2021
  8. Derrick StoleeNov 19, 2021
  9. Ævar Arnfjörð BjarmasonNov 19, 2021
  10. Chris TorekNov 20, 2021
  11. Junio C HamanoNov 21, 2021
  12. Philip OakleyNov 23, 2021
  13. Danial AlihosseiniNov 23, 2021

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.