{"thread":{"id":"28209","subject":"git clean --exclude broken?","startedAt":"2011-08-24T19:15:29Z","lastAt":"2011-08-28T12:31:22Z","messageCount":11,"participants":["Todd Rinaldo","Junio C Hamano","Michael Schubert","Thomas Rast","Pete Wyckoff"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"174183","messageId":"A04A4D84-16CC-438C-8828-0D11BE9DE2DA@cpanel.net","threadId":"28209","inReplyTo":null,"subject":"git clean --exclude broken?","fromName":"Todd Rinaldo","fromEmail":"toddr@cpanel.net","sentAt":"2011-08-24T19:15:29Z","receivedAt":"2011-08-24T19:15:29Z","isPatch":false,"sender":{"key":"toddr@cpanel.net","avatar":"https://gravatar.com/avatar/4ee23baee1044d8a3d1d821112d49aaa97976404be3ef6afa42c5bc72f660a28?d=mp&s=160"},"body":"I think I have found a new bug in 1.7.5:\n# Setup:\nmkdir tmp && cd tmp\ngit init\nmkdir foo && touch foo/bar\nmkdir bar && touch bar/baz\necho \"/foo\" > .gitignore\necho \"/bar\" >> .gitignore\ngit add .gitignore\ngit commit -m ignore\n\n# The problem (Why is foo/ removed?)\n$>git clean -dXf --exclude=/foo\nRemoving bar/\nRemoving foo/\n\nI apologize if this isn't the correct channel to report a bug. Does anyone know if this is a known issue?\n\nThanks,\nTodd Rinaldo\n"},{"id":"174192","messageId":"7vliuio65w.fsf@alter.siamese.dyndns.org","threadId":"28209","inReplyTo":"A04A4D84-16CC-438C-8828-0D11BE9DE2DA@cpanel.net","subject":"Re: git clean --exclude broken?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-24T21:23:23Z","receivedAt":"2011-08-24T21:23:23Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Todd Rinaldo <toddr@cpanel.net> writes:\n\n> I think I have found a new bug in 1.7.5:\n\nMy quick check indicates 1.7.3 behaves the same way, and 1.7.2.5 didn't\nhave --exclude option, so this does not seem to be anything particularly\nnew in the 1.7.5 release.\n\n> # The problem (Why is foo/ removed?)\n> $>git clean -dXf --exclude=/foo\n> Removing bar/\n> Removing foo/\n\nWhy is this command line giving -X that tells us not to use the ignore\nrules, and --exclude option at the same time?\n"},{"id":"174199","messageId":"F6809F96-2D71-482C-934F-2CF4EA74FEA1@cpanel.net","threadId":"28209","inReplyTo":"7vliuio65w.fsf@alter.siamese.dyndns.org","subject":"Re: git clean --exclude broken?","fromName":"Todd Rinaldo","fromEmail":"toddr@cpanel.net","sentAt":"2011-08-24T23:08:28Z","receivedAt":"2011-08-24T23:08:28Z","isPatch":false,"sender":{"key":"toddr@cpanel.net","avatar":"https://gravatar.com/avatar/4ee23baee1044d8a3d1d821112d49aaa97976404be3ef6afa42c5bc72f660a28?d=mp&s=160"},"body":"\nOn Aug 24, 2011, at 4:23 PM, Junio C Hamano wrote:\n\n> Todd Rinaldo <toddr@cpanel.net> writes:\n> \n>> I think I have found a new bug in 1.7.5:\n> \n> My quick check indicates 1.7.3 behaves the same way, and 1.7.2.5 didn't\n> have --exclude option, so this does not seem to be anything particularly\n> new in the 1.7.5 release.\nNo. I was just clarifying what my binary was for research purposes.\n\n> \n>> # The problem (Why is foo/ removed?)\n>> $>git clean -dXf --exclude=/foo\n>> Removing bar/\n>> Removing foo/\n> \n> Why is this command line giving -X that tells us not to use the ignore\n> rules, and --exclude option at the same time?\nMy more complicated use of the command wanted to use the .gitignore rules to cleanup ignored files with the exception of 1 directory. I believe -dxf --exclude is also broken in the same way.\n"},{"id":"174205","messageId":"7vfwkqmfsh.fsf@alter.siamese.dyndns.org","threadId":"28209","inReplyTo":"7vliuio65w.fsf@alter.siamese.dyndns.org","subject":"Re: git clean --exclude broken?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-25T01:38:22Z","receivedAt":"2011-08-25T01:38:22Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Todd Rinaldo <toddr@cpanel.net> writes:\n>\n>> I think I have found a new bug in 1.7.5:\n>\n> My quick check indicates 1.7.3 behaves the same way, and 1.7.2.5 didn't\n> have --exclude option, so this does not seem to be anything particularly\n> new in the 1.7.5 release.\n>\n>> # The problem (Why is foo/ removed?)\n>> $>git clean -dXf --exclude=/foo\n>> Removing bar/\n>> Removing foo/\n>\n> Why is this command line giving -X that tells us not to use the ignore\n> rules, and --exclude option at the same time?\n\nThe documentation and the implementation of \"git clean\" is quite confused.\nHere is what is said about \"-e\":\n\n    -e <pattern>::\n    --exclude=<pattern>::\n            Specify special exceptions to not be cleaned.  Each <pattern> is\n            the same form as in $GIT_DIR/info/excludes and this option can be\n            given multiple times.\n\nBut in reality, it is not about \"not be cleaned\" at all. A better\ndescription to reflect what the implementation actually does is probably\nthis:\n\n\tIn addition to what are found in usual places like .gitignore (per\n\tdirectory) and $GIT_DIR/info/exclude, consider these patterns to\n\tbe in the ignore rules.\n\nThis mirrors what --exclude parameter to \"ls-files\" does [*1*].\n\nI can however see a use case where the user wants to say something like\nthis which is quite different:\n\n\tI know \"git clean\" (or \"git clean -x\" or \"git clean -X\") will try\n\tto remove paths A, B and C. I want it remove them except for this\n\tparticular path C by adding --except=C option to the command line.\n\nAnd the current documentation does look like it is describing such an\noption. But that is not what --exclude option is about.\n\nOne solution might be to say \"I know the usual rules stored in .gitignore\nand the like tell us to that 'foo' is ignored (and to be cleaned), but for\nthis invocation only, please treat 'foo' is _not_ ignored.\", and there\nindeed is a way to do so:\n\n    $ git clean -d -X -e \\!foo\n\n(the backslash before '!' is to avoid history substitution in some shells).\n\n\n[Footnote]\n\n*1* This part in builtin/clean.c looks a bit distasteful:\n\n\tfor (i = 0; i < exclude_list.nr; i++)\n\t\tadd_exclude(exclude_list.items[i].string, \"\", 0, dir.exclude_list);\n\nThe last parameter should be &dir.exclude_list[EXC_CMDL] because we are\nadding exclude patterns from the command line.  It works by accident\nonly because EXC_CMDL happens to be defined as 0.\n"},{"id":"174245","messageId":"7vpqjtl4yi.fsf_-_@alter.siamese.dyndns.org","threadId":"28209","inReplyTo":"7vfwkqmfsh.fsf@alter.siamese.dyndns.org","subject":"Re* git clean --exclude broken?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-25T18:29:57Z","receivedAt":"2011-08-25T18:29:57Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> The documentation and the implementation of \"git clean\" is quite confused.\n> ...\n\nSo here is a patch to fix the confusion.\n\nIt does not add a new \"--except=C\" I alluded to, but at least it should\nbe the right first step to make the document clearly describe what the\nexisting option does.\n\n-- >8 --\nSubject: [PATCH] Documentation: clarify \"git clean -e <pattern>\"\n\nThe current explanation of -e can be misread as allowing the user to say\n\n    I know 'git clean -XYZ' (substitute -XYZ with any option and/or\n    parameter) will remove paths A, B, and C, and I want them all removed\n    except for paths matching this pattern by adding '-e C' to the same\n    command line, i.e. 'git clean -e C -XYZ'.\n\nBut that is not what this option does. It augments the set of ignore rules\nfrom the command line, just like the same \"-e <pattern>\" argument does\nwith the \"ls-files\" command (the user could probably pass \"-e \\!C\" to tell\nthe command to clean everything the command would normally remove, except\nfor C).\n\nIt also fixes small style nit in the parameter to add_exclude() call. The\ncurrent code only works because EXC_CMDL happens to be defined as 0.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/git-clean.txt |    6 +++---\n builtin/clean.c             |    5 ++++-\n 2 files changed, 7 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt\nindex 974e04e..a7a18e3 100644\n--- a/Documentation/git-clean.txt\n+++ b/Documentation/git-clean.txt\n@@ -47,9 +47,9 @@ OPTIONS\n \n -e <pattern>::\n --exclude=<pattern>::\n-\tSpecify special exceptions to not be cleaned.  Each <pattern> is\n-\tthe same form as in $GIT_DIR/info/excludes and this option can be\n-\tgiven multiple times.\n+\tIn addition to what are found in .gitignore (per directory) and\n+\t$GIT_DIR/info/exclude, also consider these patterns to be in the\n+\tset of the ignore rules in effect.\n \n -x::\n \tDon't use the ignore rules.  This allows removing all untracked\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex 75697f7..3782718 100644\n--- a/builtin/clean.c\n+++ b/builtin/clean.c\n@@ -76,6 +76,8 @@ int cmd_clean(int argc, const char **argv, const char *prefix)\n \n \tif (ignored && ignored_only)\n \t\tdie(_(\"-x and -X cannot be used together\"));\n+\tif (ignored && exclude_list.nr)\n+\t\tdie(_(\"adding exclude with -e and ignoring it with -x is crazy\"));\n \n \tif (!show_only && !force) {\n \t\tif (config_set)\n@@ -98,7 +100,8 @@ int cmd_clean(int argc, const char **argv, const char *prefix)\n \t\tsetup_standard_excludes(&dir);\n \n \tfor (i = 0; i < exclude_list.nr; i++)\n-\t\tadd_exclude(exclude_list.items[i].string, \"\", 0, dir.exclude_list);\n+\t\tadd_exclude(exclude_list.items[i].string, \"\", 0,\n+\t\t\t    &dir.exclude_list[EXC_CMDL]);\n \n \tpathspec = get_pathspec(prefix, argv);\n \n"},{"id":"174248","messageId":"4E5696AE.4010201@elegosoft.com","threadId":"28209","inReplyTo":"7vpqjtl4yi.fsf_-_@alter.siamese.dyndns.org","subject":"Re: Re* git clean --exclude broken?","fromName":"Michael Schubert","fromEmail":"mschub@elegosoft.com","sentAt":"2011-08-25T18:38:38Z","receivedAt":"2011-08-25T18:38:38Z","isPatch":false,"sender":{"key":"mschub@elegosoft.com","avatar":null},"body":"On 08/25/2011 08:29 PM, Junio C Hamano wrote:\n> diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt\n> index 974e04e..a7a18e3 100644\n> --- a/Documentation/git-clean.txt\n> +++ b/Documentation/git-clean.txt\n> @@ -47,9 +47,9 @@ OPTIONS\n>  \n>  -e <pattern>::\n>  --exclude=<pattern>::\n> -\tSpecify special exceptions to not be cleaned.  Each <pattern> is\n> -\tthe same form as in $GIT_DIR/info/excludes and this option can be\n> -\tgiven multiple times.\n> +\tIn addition to what are found in .gitignore (per directory) and\n> +\t$GIT_DIR/info/exclude, also consider these patterns to be in the\n> +\tset of the ignore rules in effect.\n\nNitpick: Shouldn't this be \"In addition to what is found in ..\" or\n\"In addition to those found in ..\"?\n"},{"id":"174261","messageId":"7vei09jkx3.fsf@alter.siamese.dyndns.org","threadId":"28209","inReplyTo":"4E5696AE.4010201@elegosoft.com","subject":"Re: Re* git clean --exclude broken?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-25T20:28:08Z","receivedAt":"2011-08-25T20:28:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Schubert <mschub@elegosoft.com> writes:\n\n> Nitpick: Shouldn't this be \"In addition to what is found in ..\" or\n> \"In addition to those found in ..\"?\n\nThanks.\n"},{"id":"174310","messageId":"201108261200.25792.trast@student.ethz.ch","threadId":"28209","inReplyTo":"7vpqjtl4yi.fsf_-_@alter.siamese.dyndns.org","subject":"Re: Re* git clean --exclude broken?","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2011-08-26T10:00:25Z","receivedAt":"2011-08-26T10:00:25Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Junio C Hamano wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n> > The documentation and the implementation of \"git clean\" is quite confused.\n> > ...\n> \n> So here is a patch to fix the confusion.\n> \n> It does not add a new \"--except=C\" I alluded to, but at least it should\n> be the right first step to make the document clearly describe what the\n> existing option does.\n> \n> -- >8 --\n> Subject: [PATCH] Documentation: clarify \"git clean -e <pattern>\"\n\nIt's not exclusively a doc patch, is it?\n\n> +\tif (ignored && exclude_list.nr)\n> +\t\tdie(_(\"adding exclude with -e and ignoring it with -x is crazy\"));\n\nPlease also add something like the following patch, so that 'git clean -h' \ndoes not confuse the user either.\n\ndiff --git i/builtin/clean.c w/builtin/clean.c\nindex 75697f7..33a3df9 100644\n--- i/builtin/clean.c\n+++ w/builtin/clean.c\n@@ -54,7 +54,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)\n \t\tOPT_BOOLEAN('d', NULL, &remove_directories,\n \t\t\t\t\"remove whole directories\"),\n \t\t{ OPTION_CALLBACK, 'e', \"exclude\", &exclude_list, \"pattern\",\n-\t\t  \"exclude <pattern>\", PARSE_OPT_NONEG, exclude_cb },\n+\t\t  \"add <pattern> to ignore rules\", PARSE_OPT_NONEG, exclude_cb },\n \t\tOPT_BOOLEAN('x', NULL, &ignored, \"remove ignored files, too\"),\n \t\tOPT_BOOLEAN('X', NULL, &ignored_only,\n \t\t\t\t\"remove only ignored files\"),\n\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"174399","messageId":"20110827235458.GA8124@arf.padd.com","threadId":"28209","inReplyTo":"7vpqjtl4yi.fsf_-_@alter.siamese.dyndns.org","subject":"Re: Re* git clean --exclude broken?","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2011-08-27T23:54:58Z","receivedAt":"2011-08-27T23:54:58Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"gitster@pobox.com wrote on Thu, 25 Aug 2011 11:29 -0700:\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n> > The documentation and the implementation of \"git clean\" is quite confused.\n> > ...\n> \n> So here is a patch to fix the confusion.\n> \n> It does not add a new \"--except=C\" I alluded to, but at least it should\n> be the right first step to make the document clearly describe what the\n> existing option does.\n> \n> -- >8 --\n> Subject: [PATCH] Documentation: clarify \"git clean -e <pattern>\"\n> \n> The current explanation of -e can be misread as allowing the user to say\n> \n>     I know 'git clean -XYZ' (substitute -XYZ with any option and/or\n>     parameter) will remove paths A, B, and C, and I want them all removed\n>     except for paths matching this pattern by adding '-e C' to the same\n>     command line, i.e. 'git clean -e C -XYZ'.\n> \n> But that is not what this option does. It augments the set of ignore rules\n> from the command line, just like the same \"-e <pattern>\" argument does\n> with the \"ls-files\" command (the user could probably pass \"-e \\!C\" to tell\n> the command to clean everything the command would normally remove, except\n> for C).\n> \n> It also fixes small style nit in the parameter to add_exclude() call. The\n> current code only works because EXC_CMDL happens to be defined as 0.\n> \n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  Documentation/git-clean.txt |    6 +++---\n>  builtin/clean.c             |    5 ++++-\n>  2 files changed, 7 insertions(+), 4 deletions(-)\n> \n> diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt\n> index 974e04e..a7a18e3 100644\n> --- a/Documentation/git-clean.txt\n> +++ b/Documentation/git-clean.txt\n> @@ -47,9 +47,9 @@ OPTIONS\n>  \n>  -e <pattern>::\n>  --exclude=<pattern>::\n> -\tSpecify special exceptions to not be cleaned.  Each <pattern> is\n> -\tthe same form as in $GIT_DIR/info/excludes and this option can be\n> -\tgiven multiple times.\n> +\tIn addition to what are found in .gitignore (per directory) and\n> +\t$GIT_DIR/info/exclude, also consider these patterns to be in the\n> +\tset of the ignore rules in effect.\n>  \n>  -x::\n>  \tDon't use the ignore rules.  This allows removing all untracked\n> diff --git a/builtin/clean.c b/builtin/clean.c\n> index 75697f7..3782718 100644\n> --- a/builtin/clean.c\n> +++ b/builtin/clean.c\n> @@ -76,6 +76,8 @@ int cmd_clean(int argc, const char **argv, const char *prefix)\n>  \n>  \tif (ignored && ignored_only)\n>  \t\tdie(_(\"-x and -X cannot be used together\"));\n> +\tif (ignored && exclude_list.nr)\n> +\t\tdie(_(\"adding exclude with -e and ignoring it with -x is crazy\"));\n\nThis breaks one of my use cases for git clean.\n\nWe have \"precious\" files that are listed in .gitignore so that\nthey don't show up in \"git status\" output.  They're not part of\nthe repository, but special per-user per-workspace configuration\nsettings that are required to build the code.\n\nThere's plenty of other stuff in .gitignore that should be\ndeleted.  So we invoke:\n\n    git clean -dqfx -e .magic_file -e \"Magic*\"\n\nIt's been discussed on the list a couple of times that a separate\ncategory for files that I want to ignore, but do not want to\nhave cleaned, would fill this gap.\n\n\t\t-- Pete\n\n>  \tif (!show_only && !force) {\n>  \t\tif (config_set)\n> @@ -98,7 +100,8 @@ int cmd_clean(int argc, const char **argv, const char *prefix)\n>  \t\tsetup_standard_excludes(&dir);\n>  \n>  \tfor (i = 0; i < exclude_list.nr; i++)\n> -\t\tadd_exclude(exclude_list.items[i].string, \"\", 0, dir.exclude_list);\n> +\t\tadd_exclude(exclude_list.items[i].string, \"\", 0,\n> +\t\t\t    &dir.exclude_list[EXC_CMDL]);\n>  \n>  \tpathspec = get_pathspec(prefix, argv);\n>  \n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n> \n"},{"id":"174405","messageId":"7v62li9hk5.fsf@alter.siamese.dyndns.org","threadId":"28209","inReplyTo":"20110827235458.GA8124@arf.padd.com","subject":"Re: Re* git clean --exclude broken?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-28T06:27:38Z","receivedAt":"2011-08-28T06:27:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pete Wyckoff <pw@padd.com> writes:\n\n>> diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt\n>> index 974e04e..a7a18e3 100644\n>> --- a/Documentation/git-clean.txt\n>> +++ b/Documentation/git-clean.txt\n>> @@ -47,9 +47,9 @@ OPTIONS\n>>  \n>>  -e <pattern>::\n>>  --exclude=<pattern>::\n>> -\tSpecify special exceptions to not be cleaned.  Each <pattern> is\n>> -\tthe same form as in $GIT_DIR/info/excludes and this option can be\n>> -\tgiven multiple times.\n>> +\tIn addition to what are found in .gitignore (per directory) and\n>> +\t$GIT_DIR/info/exclude, also consider these patterns to be in the\n>> +\tset of the ignore rules in effect.\n>>  \n>>  -x::\n>>  \tDon't use the ignore rules.  This allows removing all untracked\n>> diff --git a/builtin/clean.c b/builtin/clean.c\n>> index 75697f7..3782718 100644\n>> --- a/builtin/clean.c\n>> +++ b/builtin/clean.c\n>> @@ -76,6 +76,8 @@ int cmd_clean(int argc, const char **argv, const char *prefix)\n>>  \n>>  \tif (ignored && ignored_only)\n>>  \t\tdie(_(\"-x and -X cannot be used together\"));\n>> +\tif (ignored && exclude_list.nr)\n>> +\t\tdie(_(\"adding exclude with -e and ignoring it with -x is crazy\"));\n>\n> This breaks one of my use cases for git clean.\n\nThe description of '-x' needs to be also updated to reflect what it does.\n\nHow about this on top?\n\n Documentation/git-clean.txt |    4 +++-\n builtin/clean.c             |    2 --\n 2 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt\nindex b49674f..79fb984 100644\n--- a/Documentation/git-clean.txt\n+++ b/Documentation/git-clean.txt\n@@ -52,7 +52,9 @@ OPTIONS\n \tset of the ignore rules in effect.\n \n -x::\n-\tDon't use the ignore rules.  This allows removing all untracked\n+\tDon't use the standard ignore rules read from .gitignore (per\n+\tdirectory) and $GIT_DIR/info/exclude, but do still use the ignore\n+\trules given with `-e` options.  This allows removing all untracked\n \tfiles, including build products.  This can be used (possibly in\n \tconjunction with 'git reset') to create a pristine\n \tworking directory to test a clean build.\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex 7fcbf87..0c7b3d0 100644\n--- a/builtin/clean.c\n+++ b/builtin/clean.c\n@@ -76,8 +76,6 @@ int cmd_clean(int argc, const char **argv, const char *prefix)\n \n \tif (ignored && ignored_only)\n \t\tdie(_(\"-x and -X cannot be used together\"));\n-\tif (ignored && exclude_list.nr)\n-\t\tdie(_(\"adding exclude with -e and ignoring it with -x is crazy\"));\n \n \tif (!show_only && !force) {\n \t\tif (config_set)\n"},{"id":"174413","messageId":"20110828123122.GA10940@arf.padd.com","threadId":"28209","inReplyTo":"7v62li9hk5.fsf@alter.siamese.dyndns.org","subject":"Re: Re* git clean --exclude broken?","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2011-08-28T12:31:22Z","receivedAt":"2011-08-28T12:31:22Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"gitster@pobox.com wrote on Sat, 27 Aug 2011 23:27 -0700:\n> Pete Wyckoff <pw@padd.com> writes:\n> \n> >> diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt\n> >> index 974e04e..a7a18e3 100644\n> >> --- a/Documentation/git-clean.txt\n> >> +++ b/Documentation/git-clean.txt\n> >> @@ -47,9 +47,9 @@ OPTIONS\n> >>  \n> >>  -e <pattern>::\n> >>  --exclude=<pattern>::\n> >> -\tSpecify special exceptions to not be cleaned.  Each <pattern> is\n> >> -\tthe same form as in $GIT_DIR/info/excludes and this option can be\n> >> -\tgiven multiple times.\n> >> +\tIn addition to what are found in .gitignore (per directory) and\n> >> +\t$GIT_DIR/info/exclude, also consider these patterns to be in the\n> >> +\tset of the ignore rules in effect.\n> >>  \n> >>  -x::\n> >>  \tDon't use the ignore rules.  This allows removing all untracked\n> >> diff --git a/builtin/clean.c b/builtin/clean.c\n> >> index 75697f7..3782718 100644\n> >> --- a/builtin/clean.c\n> >> +++ b/builtin/clean.c\n> >> @@ -76,6 +76,8 @@ int cmd_clean(int argc, const char **argv, const char *prefix)\n> >>  \n> >>  \tif (ignored && ignored_only)\n> >>  \t\tdie(_(\"-x and -X cannot be used together\"));\n> >> +\tif (ignored && exclude_list.nr)\n> >> +\t\tdie(_(\"adding exclude with -e and ignoring it with -x is crazy\"));\n> >\n> > This breaks one of my use cases for git clean.\n> \n> The description of '-x' needs to be also updated to reflect what it does.\n> \n> How about this on top?\n> \n>  Documentation/git-clean.txt |    4 +++-\n>  builtin/clean.c             |    2 --\n>  2 files changed, 3 insertions(+), 3 deletions(-)\n> \n> diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt\n> index b49674f..79fb984 100644\n> --- a/Documentation/git-clean.txt\n> +++ b/Documentation/git-clean.txt\n> @@ -52,7 +52,9 @@ OPTIONS\n>  \tset of the ignore rules in effect.\n>  \n>  -x::\n> -\tDon't use the ignore rules.  This allows removing all untracked\n> +\tDon't use the standard ignore rules read from .gitignore (per\n> +\tdirectory) and $GIT_DIR/info/exclude, but do still use the ignore\n> +\trules given with `-e` options.  This allows removing all untracked\n>  \tfiles, including build products.  This can be used (possibly in\n>  \tconjunction with 'git reset') to create a pristine\n>  \tworking directory to test a clean build.\n> diff --git a/builtin/clean.c b/builtin/clean.c\n> index 7fcbf87..0c7b3d0 100644\n> --- a/builtin/clean.c\n> +++ b/builtin/clean.c\n> @@ -76,8 +76,6 @@ int cmd_clean(int argc, const char **argv, const char *prefix)\n>  \n>  \tif (ignored && ignored_only)\n>  \t\tdie(_(\"-x and -X cannot be used together\"));\n> -\tif (ignored && exclude_list.nr)\n> -\t\tdie(_(\"adding exclude with -e and ignoring it with -x is crazy\"));\n>  \n>  \tif (!show_only && !force) {\n>  \t\tif (config_set)\n> \n\nThis works, thanks.  It is a confusing set of options, but we\nneed them all.  I couldn't think of a better way to describe\nhow they interact.\n\n\t\t-- Pete\n"}]}