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

Re: Cogito and --exclude vs --exclude-per-directory

From
Junio C Hamano <junkio@cox.net>
Date
Nov 16, 2005, 19:01 UTC
Message-ID
<7vd5l08li9.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20051116093630.GA2783@diana.vm.bytemark.co.uk>
Karl Hasselström <kha@treskal.com> writes:
Show 6 quoted lines
> [Note: this experiment was done with git 0.99.9g and Cogito 0.15.1, so ]
>
> It seems that --exclude patterns always take precedence over
> --exclude-per-directory patterns.
>
> Is this the intended behavior?

Yes, we had a lengthy discussion on this before ls-files acquired the exclude patterns.

Documentation/git-ls-files.txt "Exclude Patterns" summarizes the precedence rule, and it was done that way to allow command line users to override what are in individual per-directory pattern files per-invocation basis. That is, --exclude-per-directory is to store project defaults, and --exclude is for end-users to specify override per-invocation. --exclude-from has the lowest precedence to give overall default. The example in the documetation has a a good illustration.

	* --exclude-from contains '*.[oa]' to catch generic
          "uninteresting" files.
	* --exclude-per-directory files contain patterns to
          catch files that are built by the Makefile in the
          directory.
        * --exclude specifies whatever the user feels like for
          the particular invocation.

If I were writing a Porcelain, I would probably install default exclude list in /usr/lib/MyPorcelain/exclude file and point at the file with --exclude-from. I may also be tempted to check $HOME/.MyPorcelain/exclude file and add it to give defaults per user, but I do not do Porcelains, so...

Previous: Karl Hasselström
Message 3 of 3 in “Cogito and --exclude vs --exclude-per-directory”
  1. Karl HasselströmNov 16, 2005
  2. Karl HasselströmNov 16, 2005
  3. Junio C HamanoNov 16, 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.