From: Shawn Pearce Date: Fri, 17 Feb 2006 16:01:12 GMT Subject: Re: [PATCH] Make git-reset delete empty directories Message-ID: <20060217160112.GB26362@spearce.org> In-Reply-To: <20060217151654.GA26362@spearce.org> Shawn Pearce wrote: > Junio C Hamano wrote: > > I thought I said it would be a few-liner, but it appears I did > > not send that message. Actually its only a one line change if you accept Perl as Perl, but not everyone likes having their loops do nothing in the loop body whilest the condition does all of the work. --- diff --git a/git-reset.sh b/git-reset.sh index fe53fc8..e6471c0 100755 --- a/git-reset.sh +++ b/git-reset.sh @@ -88,6 +88,7 @@ case "$reset_type" in # it is ok if this fails -- it may already # have been culled by checkout-index. unlink $_; + 1 while (s,/[^/]*$,, && rmdir $_); } } ' $tmp-exists