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

Re: [RFC/PATCH] git-add: Don't exclude explicitly-specified tracked files

From
Greg Brockman <gdb@mit.edu>
Date
Aug 12, 2010, 03:19 UTC
Message-ID
<AANLkTi=uKceZZGLDP5+9DN8yBtWwt070ftWSc3J-Y63i@mail.gmail.com>
In-Reply-To
<7vaaosv8lt.fsf@alter.siamese.dyndns.org>
Show 11 quoted lines
> Here is the one that troubles me the most:
>
>  (6) git add dir/f*
>
> This _looks_ like very explicitly named from git's point of view, but from
> the end user's point of view it is not.  Depending on presense (or absense)
> of another file whose name begins with 'f' in the directory, the add will
> be either prevented or silently accepted.
>
> I am not sure what the best solution would be; I tend to think the current
> behaviour is slightly saner in the face of shell globbing.

I agree that case seems rather gray. But in what circumstances would you expect it to be a problem? I think only if the user has a tracked file with local changes that he or she does not wish to be committed. How common is it that a user will do this and expect gitignores to protect that file's changes I don't believe I've ever tried that in practice, but I also wouldn't trust gitignores to protect me from myself, as a careless 'git commit -a' would still commit my changes.

Perhaps one could add some syntax to .gitignore files that configures this behavior. I can come up with a proposal for something along those lines if you believe it would be useful. However, I don't have great use case for it, unless we also make 'git commit -a' and friends respect this configuration. (As an example, perhaps a line like +dir would mean that file should be excluded even if the user runs 'git add dir/file' while a line like dir would mean that 'git add dir/file' should succeed if dir/file is already tracked.)

Previous: Junio C HamanoNext: Matthieu Moy
Message 8 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.