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

Re: "git add $ignored_file" fail

From
Junio C Hamano <junkio@cox.net>
Date
May 17, 2006, 23:07 UTC
Message-ID
<7vd5ecb688.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0605171342370.10823@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
Show 15 quoted lines
> Well, with the new-and-improved builtin "git add", you could probably do 
> something like the appended (on top of my most recent patch).
>
> It says
>
> 	No added files - did you perhaps mean to do a 'git update-index'?
>
> whenever it finds that "git add" has ignored a file and not actually added 
> anything. That, btw, can happen either because it refused to see the file 
> in the first place (ie it was ignored), or because all the files listed 
> were already added.
>
> In both cases the warning may or may not be sensible.
>
> Anyway, I dunno. I don't have any strong opinions on this.

If you give a pattern that would match two files but one of them were hidden by .gitignore, this approach would not help you much.

Even if we wanted to say something like "if the user explicitly tells us to add etc/mtab~ by spelling it out, we should ignore *~ entry in .gitignore", the shell expansion bites us because it is done before we get to what the user give us. We cannot distinguish that with the user typing etc/?tab* for example.

If somebody (Jakub, perhaps?) cares strong enough, we could show by default "matched the pathspec but ignored by .gitignore" paths with fprintf(stderr, "ignoring '%s'\n"), and have an option -q to squelch it.

I do not have strong feeling on this, so I'll see if somebody comes up with a better implementation.

Previous: Linus TorvaldsNext: Linus Torvalds
Message 17 of 18 in “"git add $ignored_file" fail”
  1. SantiMay 16, 2006
  2. Linus TorvaldsMay 16, 2006
  3. Jakub NarebskiMay 16, 2006
  4. SantiMay 16, 2006
  5. Johannes SchindelinMay 17, 2006
  6. SantiMay 17, 2006
  7. Jakub NarebskiMay 17, 2006
  8. Pavel RoskinMay 17, 2006
  9. SeanMay 17, 2006
  10. Jakub NarebskiMay 17, 2006
  11. Johannes SchindelinMay 17, 2006
  12. Linus TorvaldsMay 17, 2006
  13. Pavel RoskinMay 17, 2006
  14. Linus TorvaldsMay 17, 2006
  15. Jakub NarebskiMay 17, 2006
  16. Linus TorvaldsMay 17, 2006
  17. Junio C HamanoMay 17, 2006
  18. Linus TorvaldsMay 17, 2006

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.