* Re: Re* git clean --exclude broken?
2011-08-25 18:29 ` Re* " Junio C Hamano
@ 2011-08-25 18:38 ` Michael Schubert
2011-08-25 20:28 ` Junio C Hamano
2011-08-26 10:00 ` Thomas Rast
2011-08-27 23:54 ` Pete Wyckoff
2 siblings, 1 reply; 11+ messages in thread
From: Michael Schubert @ 2011-08-25 18:38 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Todd Rinaldo
On 08/25/2011 08:29 PM, Junio C Hamano wrote:
> diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt
> index 974e04e..a7a18e3 100644
> --- a/Documentation/git-clean.txt
> +++ b/Documentation/git-clean.txt
> @@ -47,9 +47,9 @@ OPTIONS
>
> -e <pattern>::
> --exclude=<pattern>::
> - Specify special exceptions to not be cleaned. Each <pattern> is
> - the same form as in $GIT_DIR/info/excludes and this option can be
> - given multiple times.
> + In addition to what are found in .gitignore (per directory) and
> + $GIT_DIR/info/exclude, also consider these patterns to be in the
> + set of the ignore rules in effect.
Nitpick: Shouldn't this be "In addition to what is found in .." or
"In addition to those found in .."?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Re* git clean --exclude broken?
2011-08-25 18:29 ` Re* " Junio C Hamano
2011-08-25 18:38 ` Michael Schubert
@ 2011-08-26 10:00 ` Thomas Rast
2011-08-27 23:54 ` Pete Wyckoff
2 siblings, 0 replies; 11+ messages in thread
From: Thomas Rast @ 2011-08-26 10:00 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Todd Rinaldo
Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
> > The documentation and the implementation of "git clean" is quite confused.
> > ...
>
> So here is a patch to fix the confusion.
>
> It does not add a new "--except=C" I alluded to, but at least it should
> be the right first step to make the document clearly describe what the
> existing option does.
>
> -- >8 --
> Subject: [PATCH] Documentation: clarify "git clean -e <pattern>"
It's not exclusively a doc patch, is it?
> + if (ignored && exclude_list.nr)
> + die(_("adding exclude with -e and ignoring it with -x is crazy"));
Please also add something like the following patch, so that 'git clean -h'
does not confuse the user either.
diff --git i/builtin/clean.c w/builtin/clean.c
index 75697f7..33a3df9 100644
--- i/builtin/clean.c
+++ w/builtin/clean.c
@@ -54,7 +54,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
OPT_BOOLEAN('d', NULL, &remove_directories,
"remove whole directories"),
{ OPTION_CALLBACK, 'e', "exclude", &exclude_list, "pattern",
- "exclude <pattern>", PARSE_OPT_NONEG, exclude_cb },
+ "add <pattern> to ignore rules", PARSE_OPT_NONEG, exclude_cb },
OPT_BOOLEAN('x', NULL, &ignored, "remove ignored files, too"),
OPT_BOOLEAN('X', NULL, &ignored_only,
"remove only ignored files"),
--
Thomas Rast
trast@{inf,student}.ethz.ch
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: Re* git clean --exclude broken?
2011-08-25 18:29 ` Re* " Junio C Hamano
2011-08-25 18:38 ` Michael Schubert
2011-08-26 10:00 ` Thomas Rast
@ 2011-08-27 23:54 ` Pete Wyckoff
2011-08-28 6:27 ` Junio C Hamano
2 siblings, 1 reply; 11+ messages in thread
From: Pete Wyckoff @ 2011-08-27 23:54 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Todd Rinaldo
gitster@pobox.com wrote on Thu, 25 Aug 2011 11:29 -0700:
> Junio C Hamano <gitster@pobox.com> writes:
>
> > The documentation and the implementation of "git clean" is quite confused.
> > ...
>
> So here is a patch to fix the confusion.
>
> It does not add a new "--except=C" I alluded to, but at least it should
> be the right first step to make the document clearly describe what the
> existing option does.
>
> -- >8 --
> Subject: [PATCH] Documentation: clarify "git clean -e <pattern>"
>
> The current explanation of -e can be misread as allowing the user to say
>
> I know 'git clean -XYZ' (substitute -XYZ with any option and/or
> parameter) will remove paths A, B, and C, and I want them all removed
> except for paths matching this pattern by adding '-e C' to the same
> command line, i.e. 'git clean -e C -XYZ'.
>
> But that is not what this option does. It augments the set of ignore rules
> from the command line, just like the same "-e <pattern>" argument does
> with the "ls-files" command (the user could probably pass "-e \!C" to tell
> the command to clean everything the command would normally remove, except
> for C).
>
> It also fixes small style nit in the parameter to add_exclude() call. The
> current code only works because EXC_CMDL happens to be defined as 0.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> Documentation/git-clean.txt | 6 +++---
> builtin/clean.c | 5 ++++-
> 2 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt
> index 974e04e..a7a18e3 100644
> --- a/Documentation/git-clean.txt
> +++ b/Documentation/git-clean.txt
> @@ -47,9 +47,9 @@ OPTIONS
>
> -e <pattern>::
> --exclude=<pattern>::
> - Specify special exceptions to not be cleaned. Each <pattern> is
> - the same form as in $GIT_DIR/info/excludes and this option can be
> - given multiple times.
> + In addition to what are found in .gitignore (per directory) and
> + $GIT_DIR/info/exclude, also consider these patterns to be in the
> + set of the ignore rules in effect.
>
> -x::
> Don't use the ignore rules. This allows removing all untracked
> diff --git a/builtin/clean.c b/builtin/clean.c
> index 75697f7..3782718 100644
> --- a/builtin/clean.c
> +++ b/builtin/clean.c
> @@ -76,6 +76,8 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
>
> if (ignored && ignored_only)
> die(_("-x and -X cannot be used together"));
> + if (ignored && exclude_list.nr)
> + die(_("adding exclude with -e and ignoring it with -x is crazy"));
This breaks one of my use cases for git clean.
We have "precious" files that are listed in .gitignore so that
they don't show up in "git status" output. They're not part of
the repository, but special per-user per-workspace configuration
settings that are required to build the code.
There's plenty of other stuff in .gitignore that should be
deleted. So we invoke:
git clean -dqfx -e .magic_file -e "Magic*"
It's been discussed on the list a couple of times that a separate
category for files that I want to ignore, but do not want to
have cleaned, would fill this gap.
-- Pete
> if (!show_only && !force) {
> if (config_set)
> @@ -98,7 +100,8 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
> setup_standard_excludes(&dir);
>
> for (i = 0; i < exclude_list.nr; i++)
> - add_exclude(exclude_list.items[i].string, "", 0, dir.exclude_list);
> + add_exclude(exclude_list.items[i].string, "", 0,
> + &dir.exclude_list[EXC_CMDL]);
>
> pathspec = get_pathspec(prefix, argv);
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Re* git clean --exclude broken?
2011-08-27 23:54 ` Pete Wyckoff
@ 2011-08-28 6:27 ` Junio C Hamano
2011-08-28 12:31 ` Pete Wyckoff
0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2011-08-28 6:27 UTC (permalink / raw)
To: Pete Wyckoff; +Cc: git, Todd Rinaldo
Pete Wyckoff <pw@padd.com> writes:
>> diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt
>> index 974e04e..a7a18e3 100644
>> --- a/Documentation/git-clean.txt
>> +++ b/Documentation/git-clean.txt
>> @@ -47,9 +47,9 @@ OPTIONS
>>
>> -e <pattern>::
>> --exclude=<pattern>::
>> - Specify special exceptions to not be cleaned. Each <pattern> is
>> - the same form as in $GIT_DIR/info/excludes and this option can be
>> - given multiple times.
>> + In addition to what are found in .gitignore (per directory) and
>> + $GIT_DIR/info/exclude, also consider these patterns to be in the
>> + set of the ignore rules in effect.
>>
>> -x::
>> Don't use the ignore rules. This allows removing all untracked
>> diff --git a/builtin/clean.c b/builtin/clean.c
>> index 75697f7..3782718 100644
>> --- a/builtin/clean.c
>> +++ b/builtin/clean.c
>> @@ -76,6 +76,8 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
>>
>> if (ignored && ignored_only)
>> die(_("-x and -X cannot be used together"));
>> + if (ignored && exclude_list.nr)
>> + die(_("adding exclude with -e and ignoring it with -x is crazy"));
>
> This breaks one of my use cases for git clean.
The description of '-x' needs to be also updated to reflect what it does.
How about this on top?
Documentation/git-clean.txt | 4 +++-
builtin/clean.c | 2 --
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt
index b49674f..79fb984 100644
--- a/Documentation/git-clean.txt
+++ b/Documentation/git-clean.txt
@@ -52,7 +52,9 @@ OPTIONS
set of the ignore rules in effect.
-x::
- Don't use the ignore rules. This allows removing all untracked
+ Don't use the standard ignore rules read from .gitignore (per
+ directory) and $GIT_DIR/info/exclude, but do still use the ignore
+ rules given with `-e` options. This allows removing all untracked
files, including build products. This can be used (possibly in
conjunction with 'git reset') to create a pristine
working directory to test a clean build.
diff --git a/builtin/clean.c b/builtin/clean.c
index 7fcbf87..0c7b3d0 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -76,8 +76,6 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
if (ignored && ignored_only)
die(_("-x and -X cannot be used together"));
- if (ignored && exclude_list.nr)
- die(_("adding exclude with -e and ignoring it with -x is crazy"));
if (!show_only && !force) {
if (config_set)
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: Re* git clean --exclude broken?
2011-08-28 6:27 ` Junio C Hamano
@ 2011-08-28 12:31 ` Pete Wyckoff
0 siblings, 0 replies; 11+ messages in thread
From: Pete Wyckoff @ 2011-08-28 12:31 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Todd Rinaldo
gitster@pobox.com wrote on Sat, 27 Aug 2011 23:27 -0700:
> Pete Wyckoff <pw@padd.com> writes:
>
> >> diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt
> >> index 974e04e..a7a18e3 100644
> >> --- a/Documentation/git-clean.txt
> >> +++ b/Documentation/git-clean.txt
> >> @@ -47,9 +47,9 @@ OPTIONS
> >>
> >> -e <pattern>::
> >> --exclude=<pattern>::
> >> - Specify special exceptions to not be cleaned. Each <pattern> is
> >> - the same form as in $GIT_DIR/info/excludes and this option can be
> >> - given multiple times.
> >> + In addition to what are found in .gitignore (per directory) and
> >> + $GIT_DIR/info/exclude, also consider these patterns to be in the
> >> + set of the ignore rules in effect.
> >>
> >> -x::
> >> Don't use the ignore rules. This allows removing all untracked
> >> diff --git a/builtin/clean.c b/builtin/clean.c
> >> index 75697f7..3782718 100644
> >> --- a/builtin/clean.c
> >> +++ b/builtin/clean.c
> >> @@ -76,6 +76,8 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
> >>
> >> if (ignored && ignored_only)
> >> die(_("-x and -X cannot be used together"));
> >> + if (ignored && exclude_list.nr)
> >> + die(_("adding exclude with -e and ignoring it with -x is crazy"));
> >
> > This breaks one of my use cases for git clean.
>
> The description of '-x' needs to be also updated to reflect what it does.
>
> How about this on top?
>
> Documentation/git-clean.txt | 4 +++-
> builtin/clean.c | 2 --
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt
> index b49674f..79fb984 100644
> --- a/Documentation/git-clean.txt
> +++ b/Documentation/git-clean.txt
> @@ -52,7 +52,9 @@ OPTIONS
> set of the ignore rules in effect.
>
> -x::
> - Don't use the ignore rules. This allows removing all untracked
> + Don't use the standard ignore rules read from .gitignore (per
> + directory) and $GIT_DIR/info/exclude, but do still use the ignore
> + rules given with `-e` options. This allows removing all untracked
> files, including build products. This can be used (possibly in
> conjunction with 'git reset') to create a pristine
> working directory to test a clean build.
> diff --git a/builtin/clean.c b/builtin/clean.c
> index 7fcbf87..0c7b3d0 100644
> --- a/builtin/clean.c
> +++ b/builtin/clean.c
> @@ -76,8 +76,6 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
>
> if (ignored && ignored_only)
> die(_("-x and -X cannot be used together"));
> - if (ignored && exclude_list.nr)
> - die(_("adding exclude with -e and ignoring it with -x is crazy"));
>
> if (!show_only && !force) {
> if (config_set)
>
This works, thanks. It is a confusing set of options, but we
need them all. I couldn't think of a better way to describe
how they interact.
-- Pete
^ permalink raw reply [flat|nested] 11+ messages in thread