Merge pull request 'Ignore temporary files for directory size' (#1748) from Gusted/forgejo:forgejo-bp-1742 into v1.21/forgejo-dependency

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1748
This commit is contained in:
Gusted 2023-11-10 19:41:06 +00:00
commit d65e3bddcd

View file

@ -167,7 +167,11 @@ func getDirectorySize(path string) (int64, error) {
} }
return err return err
} }
if info.IsDir() {
fileName := info.Name()
// Ignore temporary Git files as they will like be missing once info.Info is
// called and cause a disrupt to the whole operation.
if info.IsDir() || strings.HasSuffix(fileName, ".lock") || strings.HasPrefix(filepath.Base(fileName), "tmp_graph") {
return nil return nil
} }
f, err := info.Info() f, err := info.Info()