On Tue, Mar 26, 2013 at 02:07:44PM +0100, Richard Weinberger wrote:

> >Should this important warning be part of the git(1) documentation on
> >the environment variables (and possibly other places) given the
> >consequences of this case? It wasn't something
> >I'd appreciated from a simple reading.
> BTW: Can't we change git-clean such that it will not delete any files
> if GIT_DIR is set and GIT_WORK_TREE is "."?s

We could, but that would break the existing behavior for other people
(and I assume you mean "when GIT_WORK_TREE is not set at all", as I
would think GIT_WORK_TREE=. is explicit enough).

I am sympathetic to your data loss, but I wonder how common a problem it
is in practice. Git-clean already does a dry-run by default; you have to
give it `-f`. This is the first such report we've had. This seems more
akin to "oops, I accidentally ran `rm -rf` in the wrong directory". Yes,
it's catastrophic, but at some point you have to accept that deleting
files is what rm (and git-clean) does; you can only put so many safety
hoops in place.

I don't know. It's an uncommon enough case that we could deprecate
"GIT_WORK_TREE is implicitly `.`" entirely, but I think it would need a
deprecation period, and a way to get the same behavior (e.g., allowing

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to