Ambiguity on .gitignore vs pathspec ... pathspec

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

 



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




[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