Re: Small "git clean" annoyance
- From
Erik Faye-Lund <kusmabite@gmail.com>
- Date
- Apr 1, 2011, 08:29 UTC
- Message-ID
- <AANLkTikP17k4FWgfuZa6Fto5qtp1Bp_+4vOBwp=e2JZy@mail.gmail.com>
- In-Reply-To
- <AANLkTikksQj3HfOJmi-uZTfc7sTNNuDA4bFVaj2cY3Ad@mail.gmail.com>
On Fri, Apr 1, 2011 at 9:34 AM, Alex Riesen <raa.lkml@gmail.com> wrote:
Show 21 quoted lines
> On Fri, Apr 1, 2011 at 00:01, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
>> Now, I realize that if the directory isn't empty, and is unreadable,
>> we really should give up (although a better error message about _why_
>> we failed may be in order) rather than try to chmod it or anything
>> like that. But the simple "try to rmdir it" might be a good addition
>> for the trivial case.
>
> Something like this?
>
> diff --git a/dir.c b/dir.c
> index 325fb56..7251426 100644
> --- a/dir.c
> +++ b/dir.c
> @@ -1191,8 +1191,11 @@ int remove_dir_recursively(struct strbuf *path, int flag)
> return 0;
>
> dir = opendir(path->buf);
> - if (!dir)
> + if (!dir) {
> + if (rmdir(path->buf) == 0)nit-pick: don't we usually do "if (!rmdir(path->buf))"?