git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Christoph Hellwig <hch@lst.de>, Paul Mackerras <paulus@samba.org>,
	linuxppc64-dev@ozlabs.org, Git Mailing List <git@vger.kernel.org>,
	Fredrik Kuivinen <freku045@student.liu.se>
Subject: [PATCH] merge-recursive::removeFile: remove empty directories
Date: Sat, 19 Nov 2005 20:14:48 -0800	[thread overview]
Message-ID: <7vy83k2bwn.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: Pine.LNX.4.64.0511190957320.13959@g5.osdl.org

When the last file in a directory is removed as the result of a
merge, try to rmdir the now-empty directory.

Signed-off-by: Junio C Hamano <junkio@cox.net>

---

 And this is the one for 'git pull -s recursive' which is the
 default these days.

 git-merge-recursive.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

applies-to: ea62f7003bb2769fa23d5ca371d84cee9d2ec46f
80e21a9ed809d98788ff6fb705d911bee37d460b
diff --git a/git-merge-recursive.py b/git-merge-recursive.py
index d7d36aa..37258ad 100755
--- a/git-merge-recursive.py
+++ b/git-merge-recursive.py
@@ -293,6 +293,10 @@ def removeFile(clean, path):
         except OSError, e:
             if e.errno != errno.ENOENT and e.errno != errno.EISDIR:
                 raise
+        try:
+            os.removedirs(os.path.dirname(path))
+        except:
+            pass
 
 def uniquePath(path, branch):
     def fileExists(path):
---
0.99.9.GIT

  parent reply	other threads:[~2005-11-20  4:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <17279.1674.22992.607091@cargo.ozlabs.ibm.com>
     [not found] ` <20051119140736.GA24901@lst.de>
2005-11-19 18:24   ` please pull powerpc-merge.git Linus Torvalds
2005-11-20  4:14     ` [PATCH] merge-one-file: remove empty directories Junio C Hamano
2005-11-20 17:17       ` Linus Torvalds
2005-11-20 18:08         ` H. Peter Anvin
2005-11-21 14:22           ` Alex Riesen
2005-11-21  0:00         ` Johannes Schindelin
2005-11-20  4:14     ` Junio C Hamano [this message]
2005-11-20 11:51       ` [PATCH] merge-recursive::removeFile: " Fredrik Kuivinen

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=7vy83k2bwn.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=freku045@student.liu.se \
    --cc=git@vger.kernel.org \
    --cc=hch@lst.de \
    --cc=linuxppc64-dev@ozlabs.org \
    --cc=paulus@samba.org \
    --cc=torvalds@osdl.org \
    /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).