git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Ambiguity on .gitignore vs pathspec ... pathspec
@ 2023-01-09 17:02 Σταύρος Ντέντος
  0 siblings, 0 replies; only message in thread
From: Σταύρος Ντέντος @ 2023-01-09 17:02 UTC (permalink / raw)
  To: git

Hello there,

I believe I have found a behavior that I cannot explain via the
manpages https://git-scm.com/docs/gitignore#_pattern_format and
https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec:

For the repo:

```
$ git-ls-files$ (master +) tree
.
├── a
│   └── schemas
│       ├── a_schema.json
│       ├── a_schema.yaml
│       ├── fema.json
│       └── fema.yaml
├── b
│   └── schemas
│       ├── a_schema.json
│       ├── a_schema.yaml
│       ├── fema.json
│       └── fema.yaml
└── schemas
    ├── a_schema.json
    ├── a_schema.yaml
    ├── fema.json
    └── fema.yaml

5 directories, 12 files
```

and all YAML files committed, I get:

```
git-ls-files$ (master +) git status
On branch master
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
new file:   .gitignore

Untracked files:
  (use "git add <file>..." to include in what will be committed)
a/schemas/a_schema.json
a/schemas/fema.json
b/schemas/a_schema.json
b/schemas/fema.json

git-ls-files$ (master +) cat .gitignore
**schemas/*.json
git-ls-files$ (master +) git ls-files '**schemas/*.yaml'
a/schemas/a_schema.yaml
a/schemas/fema.yaml
b/schemas/a_schema.yaml
b/schemas/fema.yaml
schemas/a_schema.yaml
schemas/fema.yaml
git-ls-files$ (master +) git ls-files '**/schemas/*.yaml'
a/schemas/a_schema.yaml
a/schemas/fema.yaml
b/schemas/a_schema.yaml
b/schemas/fema.yaml
```

It seems to me that I have to use different pathspec definition in the
`.gitignore` file, and different on the commands (and they are
"exactly opposite" :/)

With regards,
Ntentos Stavros

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-09 17:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-09 17:02 Ambiguity on .gitignore vs pathspec ... pathspec Σταύρος Ντέντος

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).