git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Σταύρος Ντέντος" <stdedos@gmail.com>
To: git <git@vger.kernel.org>
Subject: Ambiguity on .gitignore vs pathspec ... pathspec
Date: Mon, 9 Jan 2023 19:02:43 +0200	[thread overview]
Message-ID: <CAHMHMxWta9Q3O9enn_ntAMdQnE2n_2RPA_Tg0psM+4BEE8dpeA@mail.gmail.com> (raw)

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

                 reply	other threads:[~2023-01-09 17:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHMHMxWta9Q3O9enn_ntAMdQnE2n_2RPA_Tg0psM+4BEE8dpeA@mail.gmail.com \
    --to=stdedos@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).