git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Make git-reset delete empty directories

From
Shawn Pearce <spearce@spearce.org>
Date
Feb 17, 2006, 16:01 UTC
Message-ID
<20060217160112.GB26362@spearce.org>
In-Reply-To
<20060217151654.GA26362@spearce.org>
Shawn Pearce <spearce@spearce.org> wrote:
> 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.

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
Previous: Shawn Pearce
Message 4 of 4 in “Make git-reset delete empty directories”
  1. Make git-reset delete empty directoriesShawn Pearce, Feb 17, 2006
  2. Junio C HamanoFeb 17, 2006
  3. Shawn PearceFeb 17, 2006
  4. Shawn PearceFeb 17, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.