{"thread":{"id":"59059","subject":"Ambiguity on .gitignore vs pathspec ... pathspec","startedAt":"2023-01-09T17:05:05Z","lastAt":"2023-01-09T17:05:05Z","messageCount":1,"participants":["Σταύρος Ντέντος"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"469981","messageId":"CAHMHMxWta9Q3O9enn_ntAMdQnE2n_2RPA_Tg0psM+4BEE8dpeA@mail.gmail.com","threadId":"59059","inReplyTo":null,"subject":"Ambiguity on .gitignore vs pathspec ... pathspec","fromName":"Σταύρος Ντέντος","fromEmail":"stdedos@gmail.com","sentAt":"2023-01-09T17:02:43Z","receivedAt":"2023-01-09T17:05:05Z","isPatch":false,"sender":{"key":"stdedos@gmail.com","avatar":null},"body":"Hello there,\n\nI believe I have found a behavior that I cannot explain via the\nmanpages https://git-scm.com/docs/gitignore#_pattern_format and\nhttps://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec:\n\nFor the repo:\n\n```\n$ git-ls-files$ (master +) tree\n.\n├── a\n│   └── schemas\n│       ├── a_schema.json\n│       ├── a_schema.yaml\n│       ├── fema.json\n│       └── fema.yaml\n├── b\n│   └── schemas\n│       ├── a_schema.json\n│       ├── a_schema.yaml\n│       ├── fema.json\n│       └── fema.yaml\n└── schemas\n    ├── a_schema.json\n    ├── a_schema.yaml\n    ├── fema.json\n    └── fema.yaml\n\n5 directories, 12 files\n```\n\nand all YAML files committed, I get:\n\n```\ngit-ls-files$ (master +) git status\nOn branch master\nChanges to be committed:\n  (use \"git restore --staged <file>...\" to unstage)\nnew file:   .gitignore\n\nUntracked files:\n  (use \"git add <file>...\" to include in what will be committed)\na/schemas/a_schema.json\na/schemas/fema.json\nb/schemas/a_schema.json\nb/schemas/fema.json\n\ngit-ls-files$ (master +) cat .gitignore\n**schemas/*.json\ngit-ls-files$ (master +) git ls-files '**schemas/*.yaml'\na/schemas/a_schema.yaml\na/schemas/fema.yaml\nb/schemas/a_schema.yaml\nb/schemas/fema.yaml\nschemas/a_schema.yaml\nschemas/fema.yaml\ngit-ls-files$ (master +) git ls-files '**/schemas/*.yaml'\na/schemas/a_schema.yaml\na/schemas/fema.yaml\nb/schemas/a_schema.yaml\nb/schemas/fema.yaml\n```\n\nIt seems to me that I have to use different pathspec definition in the\n`.gitignore` file, and different on the commands (and they are\n\"exactly opposite\" :/)\n\nWith regards,\nNtentos Stavros\n"}]}