{"thread":{"id":"2550","subject":"Cogito and --exclude vs --exclude-per-directory","startedAt":"2005-11-16T09:36:30Z","lastAt":"2005-11-16T19:01:50Z","messageCount":3,"participants":["Karl Hasselström","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"12006","messageId":"20051116093630.GA2783@diana.vm.bytemark.co.uk","threadId":"2550","inReplyTo":null,"subject":"Cogito and --exclude vs --exclude-per-directory","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2005-11-16T09:36:30Z","receivedAt":"2005-11-16T09:36:30Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"[Note: this experiment was done with git 0.99.9g and Cogito 0.15.1, so ]\n\nIt seems that --exclude patterns always take precedence over\n--exclude-per-directory patterns. For example:\n\n  $ ls -a\n  ./  ../  .bar  bar.txt  .foo  foo.txt  .git/  .gitignore\n\n  $ cat .gitignore\n  !.bar\n\n  $ git-ls-files -o --exclude='.*' --exclude='!.bar'\n  .bar\n  bar.txt\n  foo.txt\n\n  $ git-ls-files -o --exclude='.*' --exclude-per-directory=.gitignore\n  bar.txt\n  foo.txt\n\nIs this the intended behavior?\n\nSince Cogito specifies a few \"default\" ignore patterns with --exclude,\n(such as .* and *.o) these become impossible to override with !\npatterns in .gitignore files. In effect, the default patterns are\ngiven priority over user-supplied patterns.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"12007","messageId":"20051116093804.GB2783@diana.vm.bytemark.co.uk","threadId":"2550","inReplyTo":"20051116093630.GA2783@diana.vm.bytemark.co.uk","subject":"Re: Cogito and --exclude vs --exclude-per-directory","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2005-11-16T09:38:04Z","receivedAt":"2005-11-16T09:38:04Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2005-11-16 10:36:30 +0100, Karl Hasselström wrote:\n\n> [Note: this experiment was done with git 0.99.9g and Cogito 0.15.1,\n> so ]\n\n. . . please scream if I should just upgrade to fix all my problems.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"12030","messageId":"7vd5l08li9.fsf@assigned-by-dhcp.cox.net","threadId":"2550","inReplyTo":"20051116093630.GA2783@diana.vm.bytemark.co.uk","subject":"Re: Cogito and --exclude vs --exclude-per-directory","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-16T19:01:50Z","receivedAt":"2005-11-16T19:01:50Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Karl Hasselström <kha@treskal.com> writes:\n\n> [Note: this experiment was done with git 0.99.9g and Cogito 0.15.1, so ]\n>\n> It seems that --exclude patterns always take precedence over\n> --exclude-per-directory patterns.\n>\n> Is this the intended behavior?\n\nYes, we had a lengthy discussion on this before ls-files\nacquired the exclude patterns.\n\nDocumentation/git-ls-files.txt \"Exclude Patterns\" summarizes the\nprecedence rule, and it was done that way to allow command line\nusers to override what are in individual per-directory pattern\nfiles per-invocation basis.  That is, --exclude-per-directory is\nto store project defaults, and --exclude is for end-users to\nspecify override per-invocation.  --exclude-from has the lowest\nprecedence to give overall default.  The example in the\ndocumetation has a a good illustration.\n\n\t* --exclude-from contains '*.[oa]' to catch generic\n          \"uninteresting\" files.\n\n\t* --exclude-per-directory files contain patterns to\n          catch files that are built by the Makefile in the\n          directory.\n\n        * --exclude specifies whatever the user feels like for\n          the particular invocation.\n\nIf I were writing a Porcelain, I would probably install default\nexclude list in /usr/lib/MyPorcelain/exclude file and point at\nthe file with --exclude-from.  I may also be tempted to check\n$HOME/.MyPorcelain/exclude file and add it to give defaults per\nuser, but I do not do Porcelains, so...\n"}]}