From cb8298b7178f5dde302604bfe34c658b725f16f8 Mon Sep 17 00:00:00 2001 From: Earl Warren <109468362+earl-warren@users.noreply.github.com> Date: Tue, 28 Nov 2023 22:53:21 +0100 Subject: [PATCH] Ignore temporary files for directory size (#28265) Co-authored-by: Gusted --- modules/repository/create.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/repository/create.go b/modules/repository/create.go index 2dac35224e..153686089c 100644 --- a/modules/repository/create.go +++ b/modules/repository/create.go @@ -167,7 +167,11 @@ func getDirectorySize(path string) (int64, error) { } 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 } f, err := info.Info()