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

Re: "git add $ignored_file" fail

From
SSanti <sbejar@gmail.com>
Date
May 16, 2006, 22:42 UTC
Message-ID
<8aa486160605161542u704ccf03w@mail.gmail.com>
In-Reply-To
<Pine.LNX.4.64.0605161526210.16475@g5.osdl.org>
2006/5/17, Linus Torvalds <torvalds@osdl.org>:
Show 28 quoted lines
>
>
> On Wed, 17 May 2006, Santi wrote:
> >
> >      When you try to add ignored files with the git-add command it
> > fails because the call to:
> >
> > git-ls-files -z \
> >        --exclude-from="$GIT_DIR/info/exclude" \
> >        --others --exclude-per-directory=.gitignore
> >
> >      does not output this file because it is ignored. I know I can do it with:
> >
> > git-update-index --add $ignored_file
> >
> > I understand the behaviour of git-ls-files but I think it is no the
> > expected for git-add, at least for me.
>
> Well, the thing is, git-add doesn't really take a "file name", it takes a
> filename _pattern_.
>
> Clearly we can't add everything that matches the pattern, because one
> common case is to add a whole subdirectory, and thus clearly the
> .gitignore file must override the pattern.
>
> So it's consistent that it overrides it also for a single filename case,
> no?
>

It's consistent from an implementation point of view, but not from the (my?) user point of view. This is why I say I understand it for git-ls-files. For the case of git-add even the usage and the man page talk about <file>...

Clearly for the case of a whole subdirectory, or even ".", the .gitignore file must override the pattern, but not for the case of a pattern that is a single existing file.

Santi
Previous: Jakub NarebskiNext: Johannes Schindelin
Message 4 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.