Re: Cogito and --exclude vs --exclude-per-directory
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:12
Karl Hasselström [off-list ref] writes:
[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...