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

Re: [RFC/PATCH] Add test case for dealing with a tracked file in an ignored directory

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Aug 19, 2010, 08:50 UTC
Message-ID
<vpqr5hv56m2.fsf@bauges.imag.fr>
In-Reply-To
<AANLkTi=u2jA5MOKwyYO_pwcZaK=A1D2g+gueFGF2L+5U@mail.gmail.com>
Greg Brockman <gdb@mit.edu> writes:
Show 11 quoted lines
>> I don't think you want to complain with "did not match any files"
>> here.
> Well, I copied the behavior of 'git add "*"' here, where every file in
> . is ignored.  E.g.
> """
> $ echo >ignore-file
> $ echo .gitignore >>.gitignore
> $ echo ignore-file >>.gitignore
> $ git add '*'
> fatal: pathspec '*' did not match any files
> """

OK, that makes sense (you can add comments to your tests or commit message to justify this is case someone wonders later).

> realized today that git globbing seems to act differently depending on
> where the wildcard appears.  E.g.:
> Is this a bug?

There are many known inconsistancies with Git globing, yes. See for example:

http://thread.gmane.org/gmane.comp.version-control.git/128672/focus=128759
Show 15 quoted lines
>> You're not testing the case
>>
>>  git add ignored-dir/
>>
>> which gives another case where Git tries to add files not explicitely
>> given on the command-line. But the correct behavior of this case may
>> be more controversial, so maybe it's indeed better to focus on the
>> other cases.
> A fair point.  I would have thought the behavior here should be
> unchanged, namely that 'git add ignored-dir/' should spit out a "The
> following paths are ignored by one of your .gitignore files: ..."
> error, regardless of the directory's contents.  Does anyone believe
> this should be different/would it be useful for me to draw up a test
> case for it now?  In any case, I'll certainly put a test case for this
> into the final patch.

It makes sense to make "git add dir/" equivalent to "git add dir/*", but I don't really care either way.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Greg BrockmanNext: Ævar Arnfjörð Bjarmason
Message 21 of 28 in “git-add: Don't exclude explicitly-specified tracked files”
  1. git-add: Don't exclude explicitly-specified tracked filesGreg Brockman, Aug 11, 2010
  2. Ævar Arnfjörð BjarmasonAug 11, 2010
  3. Jens LehmannAug 11, 2010
  4. Greg BrockmanAug 12, 2010
  5. Junio C HamanoAug 11, 2010
  6. Greg BrockmanAug 11, 2010
  7. Junio C HamanoAug 12, 2010
  8. Greg BrockmanAug 12, 2010
  9. Matthieu MoyAug 12, 2010
  10. Greg BrockmanAug 12, 2010
  11. Matthieu MoyAug 12, 2010
  12. Junio C HamanoAug 12, 2010
  13. Greg BrockmanAug 12, 2010
  14. Jonathan NiederAug 12, 2010
  15. Ævar Arnfjörð BjarmasonAug 12, 2010
  16. Greg BrockmanAug 18, 2010
  17. Add test case for dealing with a tracked file in an ignored directoryGreg Brockman, Aug 18, 2010
  18. Greg BrockmanAug 18, 2010
  19. Matthieu MoyAug 18, 2010
  20. Greg BrockmanAug 19, 2010
  21. Matthieu MoyAug 19, 2010
  22. Ævar Arnfjörð BjarmasonAug 18, 2010
  23. Matthieu MoyAug 18, 2010
  24. Ævar Arnfjörð BjarmasonAug 18, 2010
  25. Jonathan NiederAug 19, 2010
  26. Ævar Arnfjörð BjarmasonAug 19, 2010
  27. Jonathan NiederAug 25, 2010
  28. Ævar Arnfjörð BjarmasonAug 29, 2010

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.