diff options
author | Jakob Borg <jakob@nym.se> | 2014-09-04 21:59:38 +0200 |
---|---|---|
committer | Jakob Borg <jakob@nym.se> | 2014-09-04 21:59:38 +0200 |
commit | 8e4f7bbd3e624089256257b1d1ed0140e03bf245 (patch) | |
tree | 4bfdce534792830ca4713c55fcbbcc383310d1ea | |
parent | a40217cf077ba03efdd2718f213d8a99e3111ad1 (diff) | |
parent | a58564ff880d003a8360a0c0d21121bb5d3eb85c (diff) |
Merge pull request #626 from alex2108/master
staggered versioner: count directories as files (fixes #607)
-rw-r--r-- | versioner/staggered.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/versioner/staggered.go b/versioner/staggered.go index aac06c2f94..9ae00abc22 100644 --- a/versioner/staggered.go +++ b/versioner/staggered.go @@ -129,7 +129,10 @@ func (v Staggered) clean() { switch mode := f.Mode(); { case mode.IsDir(): filesPerDir[path] = 0 - + if path != v.versionsPath { + dir := filepath.Dir(path) + filesPerDir[dir]++ + } case mode.IsRegular(): extension := filepath.Ext(path) dir := filepath.Dir(path) @@ -152,15 +155,17 @@ func (v Staggered) clean() { } for path, numFiles := range filesPerDir { + if numFiles > 0 { + continue + } + if path == v.versionsPath { if debug { l.Debugln("Cleaner: versions dir is empty, don't delete", path) } continue } - if numFiles > 0 { - continue - } + if debug { l.Debugln("Cleaner: deleting empty directory", path) |