On Fri, 2014-08-22 at 10:05 +0200, Magnus Therning wrote:
> On Thu, Aug 21, 2014 at 10:16:08PM -0400, Paul Smith wrote:
> >>> Does it seem incorrect to anyone else that "git clean -X" doesn't
> >>> delete all the files in your workspace that are considered ignored
> >>> by "git status"?
> 
> Well, reading the man page for `git clean` like a lawyer (my emphasis
> below):
> 
>    -X     Remove only *files* ignored by Git. This may be useful to
>           rebuild everything from scratch, but keep manually created
>           files.
> 
> So, it could be argued it does what it says, it removes all *files*
> ignored by git, not ignored *folders*.

Yes, but that's what the -d option is for.  You'll note that the -x
option has similar language regarding files.

> I set up a small example that I hope matches your situation:

Yes, that's it.

> So git doesn't want to delete the ignored *folders* Debug/ and Release/.  Even
> more interestingly is the behaviour when we start ignoring '*.o' too:

My take on this is that "git clean" is doing a top-down operation, and
when it comes across a file that is not in .gitignore (SOMELIB.dir) it
stops and doesn't go down any further.

For "git status" on the other hand, it DOES continue to go into
SOMELIB.dir and then due to .gitignore it ends up pruning out everything
inside that directory, then it doesn't print the empty directory (since
"git status" never shows empty directories).

> I would argue that raising a bug on this is called for.

OK thanks for the analysis!

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to