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

Re: [RFD/PATCH] add: ignore only ignored files

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Nov 20, 2014, 09:42 UTC
Message-ID
<546DB778.2000000@drmicha.warpmail.net>
In-Reply-To
<xmqqbno2rhlz.fsf@gitster.dls.corp.google.com>
Junio C Hamano schrieb am 19.11.2014 um 22:43:
Show 10 quoted lines
> Jeff King <peff@peff.net> writes:
> 
>> Typically I keep a very neat .gitignore file and just use "git add .",
>> which _does_ ignore those files. The real problem here is that git
>> cannot tell the difference between "the user explicitly asked for
>> foo.aux, so we should complain" and "oops, foo.aux got caught in a shell
>> expansion".
> 
> Yup.  I also find myself doing "git cmd -- \*.ext" to let Git, not
> my shell, handle the patterns.
That is the correct way, of course.
Show 12 quoted lines
>> I almost wonder if skipping ignored files should _always_ be a warning,
>> not a hard error. I guess that has unpleasant side effects for scripts
>> which call "git add XXX" and check the exit code, who may be
>> unpleasantly surprised that they missed out on some content.
>>
>> Perhaps we could do a hybrid: add the files that were not ignored, but
>> then still exit non-zero. Careful scripts need to check the exit status
>> of "git add" anyway, and sloppy humans with over-broad wildcards
>> typically do not care about the exit status.
> 
> ;-)
> 
You can simply say "Michael" in your last subclause above :)

I'm wondering whether that behaviour change (without --ignore-errors) is OK - I don't mind, but hey, I usually don't.

I think it all comes down to the fact whether specifying an ignored file on the command line is considered an error or only "possibly a user error" we should dwim around. "git add" being plumbing, I'm somehow hesitant to change behaviour unless git is asked to ignore error. And if I'm hesitant already... oh wait. git add is declared porcelain? I would not have guessed without looking it up.

Michael
Previous: Junio C HamanoNext: Jeff King
Message 5 of 22 in “add: ignore only ignored files”
  1. add: ignore only ignored filesMichael J Gruber, Nov 19, 2014
  2. Junio C HamanoNov 19, 2014
  3. Jeff KingNov 19, 2014
  4. Junio C HamanoNov 19, 2014
  5. Michael J GruberNov 20, 2014
  6. Jeff KingNov 20, 2014
  7. Junio C HamanoNov 20, 2014
  8. Jeff KingNov 20, 2014
  9. Michael J GruberNov 21, 2014
  10. [PATCHv2] add: ignore only ignored filesMichael J Gruber, Nov 21, 2014
  11. Jeff KingNov 21, 2014
  12. Torsten BögershausenNov 22, 2014
  13. Jeff KingNov 22, 2014
  14. Torsten BögershausenNov 22, 2014
  15. Jeff KingNov 23, 2014
  16. Junio C HamanoNov 23, 2014
  17. Jeff KingNov 23, 2014
  18. Junio C HamanoNov 24, 2014
  19. Torsten BögershausenNov 24, 2014
  20. Jeff KingNov 25, 2014
  21. Michael J GruberNov 24, 2014
  22. Michael J GruberNov 24, 2014

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.