summaryrefslogtreecommitdiffstats
path: root/modules/util
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-01-14 02:54:02 +0800
committerGitHub <noreply@github.com>2023-01-13 18:54:02 +0000
commita3ab82e5924196632f1731ae3ef2099bf9d39501 (patch)
tree7b4f840dae95f4f5b2a3ff11d822e3fdf45016e6 /modules/util
parent4fc1517da0014ea4414ac51d67b26553c30139a1 (diff)
downloadgitea-a3ab82e5924196632f1731ae3ef2099bf9d39501.tar.gz
gitea-a3ab82e5924196632f1731ae3ef2099bf9d39501.zip
Fix error when calculate the repository size (#22392)
Fix #22386 `GetDirectorySize` moved as `getDirectorySize` because it becomes a special function which should not be put in `util`. Co-authored-by: Jason Song <i@wolfogre.com>
Diffstat (limited to 'modules/util')
-rw-r--r--modules/util/path.go14
1 files changed, 0 insertions, 14 deletions
diff --git a/modules/util/path.go b/modules/util/path.go
index 03013f7133..e060b527f3 100644
--- a/modules/util/path.go
+++ b/modules/util/path.go
@@ -22,20 +22,6 @@ func EnsureAbsolutePath(path, absoluteBase string) string {
return filepath.Join(absoluteBase, path)
}
-const notRegularFileMode os.FileMode = os.ModeSymlink | os.ModeNamedPipe | os.ModeSocket | os.ModeDevice | os.ModeCharDevice | os.ModeIrregular
-
-// GetDirectorySize returns the disk consumption for a given path
-func GetDirectorySize(path string) (int64, error) {
- var size int64
- err := filepath.Walk(path, func(_ string, info os.FileInfo, err error) error {
- if info != nil && (info.Mode()&notRegularFileMode) == 0 {
- size += info.Size()
- }
- return err
- })
- return size, err
-}
-
// IsDir returns true if given path is a directory,
// or returns false when it's a file or does not exist.
func IsDir(dir string) (bool, error) {