mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-04 09:19:06 +01:00
Include folders into size cost (#18158)
- Include folders for the disk consumption size, they should be included as they are also saved on the disk :) - Have a more accurate picture of the size of a repo. - Mostly they are the size of the file system's block size. E.g. 4Kb on Linux.
This commit is contained in:
parent
637c3ec5d8
commit
74a5d49e86
1 changed files with 2 additions and 2 deletions
|
@ -24,9 +24,9 @@ func EnsureAbsolutePath(path, absoluteBase string) string {
|
||||||
return filepath.Join(absoluteBase, path)
|
return filepath.Join(absoluteBase, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
const notRegularFileMode os.FileMode = os.ModeDir | os.ModeSymlink | os.ModeNamedPipe | os.ModeSocket | os.ModeDevice | os.ModeCharDevice | os.ModeIrregular
|
const notRegularFileMode os.FileMode = os.ModeSymlink | os.ModeNamedPipe | os.ModeSocket | os.ModeDevice | os.ModeCharDevice | os.ModeIrregular
|
||||||
|
|
||||||
// GetDirectorySize returns the dumb disk consumption for a given path
|
// GetDirectorySize returns the disk consumption for a given path
|
||||||
func GetDirectorySize(path string) (int64, error) {
|
func GetDirectorySize(path string) (int64, error) {
|
||||||
var size int64
|
var size int64
|
||||||
err := filepath.Walk(path, func(_ string, info os.FileInfo, err error) error {
|
err := filepath.Walk(path, func(_ string, info os.FileInfo, err error) error {
|
||||||
|
|
Loading…
Reference in a new issue