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

Re: [RFD] Ignore rules

From
Junio C Hamano <junkio@cox.net>
Date
May 15, 2005, 06:05 UTC
Message-ID
<7v4qd5vxao.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<2cfc4032050514181127c02e43@mail.gmail.com>
>>>>> "JS" == Jon Seymour <jon.seymour@gmail.com> writes:
JS> Is there value in:
JS> a. pushing the ignore logic into the core git tools such as git-ls-files

When there is an agreed upon Porcelain layer ignore logic, git-ls-files --others --exclude-from=... should be changed so that it uses the same file format and same semantics, and probably use the default ignore file without being explicitly told. Otherwise things would get quite confusing, so yes, I see value in there.

I do not however think this should apply to things like "git-update-cache --add"; because even though user may say "git-update-cache --add *" and wish it to ignore things on the ignore list, that is not how shell parameter expansion works.

I would like to see a git-path-helper command that can act as filter between "find -print0" and "xargs -0" like this:

    find * -print0 |
    git-path-helper -z --ignore-file=.git/info/ignore |
    xargs -r -0 git-update-cache --add --

I envision that we should not even need --ignore-file parameter, once we have "an agreed upon Porcelain layer ignore logic". It should read the "agreed upon" location, somewhere under the $GIT_DIR and perform the "agreed upon" filtering logic.

I further envision that this would work from anywhere in the work tree, not only from the directory that corresponds to the top of the tree structure GIT_INDEX_FILE describes. For example, in linux-2.6 git tree, you _ought_ to be able to say something like this:

    cd fs
    find ext? ../include/linux -type f -print0 |
    git-path-helper -z |
    xargs -r -0 git-update-cache --add --

The git-path-helper command could internally run getpwd() and find out the top directory (in this case, the parent directory of our current working directory "fs"), then canonicalize the incoming filenames (either relative to getpwd() or the full filesystem path) to paths relative to the top directory, apply the ignore filter and send the surviving paths downstream. Anything downstream driven with xargs -0 would get relative paths suitable for core GIT consumption.

JS> b. including the current ignore .* rule as a default ignore rule that JS> can be overridden by a .gitignore file

Knowing the number of places that assume .* are irrelevant, I would not be looking forward to doing that myself, but that behaviour would be ideal.

Previous: Jon SeymourNext: Junio C Hamano
Message 11 of 18 in “Ignore file filter”
  1. Ignore file filterDavid Greaves, May 12, 2005
  2. Petr BaudisMay 13, 2005
  3. David GreavesMay 14, 2005
  4. Junio C HamanoMay 14, 2005
  5. Petr BaudisMay 14, 2005
  6. David GreavesMay 14, 2005
  7. [RFD] Ignore rulesPetr Baudis, May 14, 2005
  8. David GreavesMay 14, 2005
  9. Junio C HamanoMay 14, 2005
  10. Jon SeymourMay 15, 2005
  11. Junio C HamanoMay 15, 2005
  12. Junio C HamanoMay 15, 2005
  13. [RFD] git-run-with-user-pathJunio C Hamano, May 15, 2005
  14. Matthias UrlichsMay 16, 2005
  15. David GreavesMay 16, 2005
  16. Petr BaudisMay 14, 2005
  17. David GreavesMay 14, 2005
  18. David GreavesMay 13, 2005

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.