From: Shawn Pearce <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Make git-reset delete empty directories
Date: Fri, 17 Feb 2006 10:16:54 -0500 [thread overview]
Message-ID: <20060217151654.GA26362@spearce.org> (raw)
In-Reply-To: <7v7j7u8koz.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
> I thought I said it would be a few-liner, but it appears I did
> not send that message.
You did. Somehow I forgot that request. I wrote a simple approach
similar to what you show below then tried to make it slightly
more efficient by only attempting to delete each directory once.
Obviously that wasn't wise on my part. :-)
> This untested one is far simpler, if less efficient, isn't it?
>
> ---
>
> diff --git a/git-reset.sh b/git-reset.sh
> index fe53fc8..195d043 100755
> --- a/git-reset.sh
> +++ b/git-reset.sh
> @@ -88,6 +88,9 @@ case "$reset_type" in
> # it is ok if this fails -- it may already
> # have been culled by checkout-index.
> unlink $_;
> + while (s|/[^/]*$|| && $_ ne "") {
> + rmdir($_) or last;
> + }
> }
> }
> ' $tmp-exists
I just ran it through the test script (t7101-reset.sh) that I
included in my patch and it passed, so clearly the version above
would be the better version to include.
Since it was untested before you are welcome to include the test
script with your version. :-)
--
Shawn.
next prev parent reply other threads:[~2006-02-17 15:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-17 7:26 [PATCH] Make git-reset delete empty directories Shawn Pearce
2006-02-17 8:15 ` Junio C Hamano
2006-02-17 15:16 ` Shawn Pearce [this message]
2006-02-17 16:01 ` Shawn Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060217151654.GA26362@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).