Subject: Re: [PATCH v2] Add --exclude to git-clean.

From: Jared Hance <[email-masked]>
Date: Mon, 19 Jul 2010 14:22:33 -0400

On Mon, Jul 19, 2010 at 10:43:43AM -0700, Junio C Hamano wrote:
> this both look wrong.  They do not tell the readers that the option takes
> a mandatory argument that specifies the "exceptions".  Worse yet,

Sorry about that. I will get that fixed.

> > +	Specify special exceptions to not be cleaned. Separate with colon.
> 
> this does not tell _how_ exceptions are specified.
> 
> What should each element on the list look like?
> 
> Is it a dot-suffix without dot (e.g. "html") or with dot (e.g. ".html")?
> Or is it a glob (e.g. "*.html")?  Or is it a full path relative to the
> worktree root (e.g. "Documentation/index.html")?
> 
> Using colon as an inter-element separator makes sense only if last one is
> true (i.e. "concrete path, not glob nor suffix"), so an intelligent reader
> could probably guess what you meant, but you shouldn't make readers guess
> in the first place.
> 
> If on the other hand you wanted to allow specifying the same kind of
> patterns used in the gitignore files from the command line:
> 
>  (1) A list separated with whitespace would be more natural, not a colon;
>      and

It is a global (like in the .gitignore file). I will change it to
whitespace. At first, I was worried about files with whitespace, and a
colon seemed to fit it better (since files don't have colons).

On the other hand, can you think of any character that would fit both
a glob and a strict filename (as it allows both)? I had trouble
figuring out what to use here.

>  (2) I have to wonder why do we give such a command line exclude override
>      to begin with.
> 
>      (2-a) wouldn't it be easier for the user to add such a local
>            configuration to $GIT_DIR/info/exclude once and be done with
>            it?

As I said earlier, its generally useful for files you are only going
to have for a few minutes and you don't want to have the clutter up
$GIT_DIR/info/exclude with them (since they probably won't ever
return).

>      (2-b) if command-line override has benefit, why is it limited to only
>            _exclude_ and not include (iow, additional ignore patterns)?

"git clean && git rm <INCLUDES>" has the same effect as including in
the clean.