diff options
author | John Cai <jcai@gitlab.com> | 2022-04-21 03:29:24 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2022-05-05 17:18:17 +0300 |
commit | 5f1ea71e1c4837f1af1a4b6511cd46344299190f (patch) | |
tree | dac130bea193fb084fae2c98525900aac9da4ad2 | |
parent | 64766d26b6d6e2f0153725bd31d9647790a0fb58 (diff) |
internalgitaly: Ignore +gitaly directory in storage
The `+gitaly` directory does not contain valid repositories. Ignore this
directory during Walk.
Changelog: changed
-rw-r--r-- | internal/gitaly/service/internalgitaly/walkrepos.go | 4 | ||||
-rw-r--r-- | internal/gitaly/service/internalgitaly/walkrepos_test.go | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/internal/gitaly/service/internalgitaly/walkrepos.go b/internal/gitaly/service/internalgitaly/walkrepos.go index 114214087..ec096ef05 100644 --- a/internal/gitaly/service/internalgitaly/walkrepos.go +++ b/internal/gitaly/service/internalgitaly/walkrepos.go @@ -43,6 +43,10 @@ func walkStorage(ctx context.Context, storagePath string, stream gitalypb.Intern return err } + if path == filepath.Join(storagePath, "+gitaly") { + return filepath.SkipDir + } + select { case <-ctx.Done(): return ctx.Err() diff --git a/internal/gitaly/service/internalgitaly/walkrepos_test.go b/internal/gitaly/service/internalgitaly/walkrepos_test.go index 34716ddc1..5a2d91b01 100644 --- a/internal/gitaly/service/internalgitaly/walkrepos_test.go +++ b/internal/gitaly/service/internalgitaly/walkrepos_test.go @@ -83,6 +83,10 @@ func TestWalkRepos(t *testing.T) { deletedRepo, _ := gittest.CloneRepo(t, cfg, cfg.Storages[0], gittest.CloneRepoOpts{ RelativePath: "b", }) + _, _ = gittest.CloneRepo(t, cfg, cfg.Storages[0], gittest.CloneRepoOpts{ + RelativePath: "+gitaly/d", + }) + modifiedDate := tc.fileModtimeFunc(t, testRepo1Path) // to test a directory being deleted during a walk, we must delete a directory after |