Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Hiltunen <shiltunen@gitlab.com>2023-06-30 13:02:36 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2023-07-06 12:28:18 +0300
commitf9f00ec62d2c831b4b36130b28c791e1349a9149 (patch)
tree3b5448c14c06b08885b32b93feb9b292b2170bb8
parent4775a42dabf21a7405c77d43c4cb24a34820b39a (diff)
Sync repository moves
Moving a repository doesn't currently get synced to the disk. This may lead to the repository not being in the expected location if the host crashes. Add the missing syncs. Since we don't know if the entire target directory hierarchy was just created, we'll sync it always. Changelog: fixed
-rw-r--r--internal/gitaly/service/repository/rename.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/gitaly/service/repository/rename.go b/internal/gitaly/service/repository/rename.go
index b97509eba..51343e681 100644
--- a/internal/gitaly/service/repository/rename.go
+++ b/internal/gitaly/service/repository/rename.go
@@ -94,6 +94,20 @@ func (s *server) renameRepository(ctx context.Context, sourceRepo, targetRepo *g
return fmt.Errorf("moving repository into place: %w", err)
}
+ storagePath, err := s.locator.GetStorageByName(targetRepo.GetStorageName())
+ if err != nil {
+ return fmt.Errorf("get storage by name: %w", err)
+ }
+
+ syncer := safe.NewSyncer()
+ if err := syncer.SyncHierarchy(storagePath, targetRepo.GetRelativePath()); err != nil {
+ return fmt.Errorf("sync hierarchy: %w", err)
+ }
+
+ if err := syncer.SyncParent(sourcePath); err != nil {
+ return fmt.Errorf("sync parent: %w", err)
+ }
+
return nil
}