Skip to content

Commit 80e21a9

Browse files
author
Junio C Hamano
committed
merge-recursive::removeFile: remove empty directories
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>
1 parent 397c766 commit 80e21a9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

git-merge-recursive.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,10 @@ def removeFile(clean, path):
293293
except OSError, e:
294294
if e.errno != errno.ENOENT and e.errno != errno.EISDIR:
295295
raise
296+
try:
297+
os.removedirs(os.path.dirname(path))
298+
except:
299+
pass
296300

297301
def uniquePath(path, branch):
298302
def fileExists(path):

0 commit comments

Comments
 (0)