diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2023-06-30 12:56:51 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2023-07-06 12:10:23 +0300 |
commit | 4775a42dabf21a7405c77d43c4cb24a34820b39a (patch) | |
tree | 8b5d3637960bb56356f83628b3261567ae5b5c20 | |
parent | f4062b3334864a3b6e8960d961f322c2015a9675 (diff) |
Sync repository removals
Repository removals are currently not synced to the disk. This may
lead to the repository appearing back on the disk either in full or
in corrupted state with deletion partially applied. As we are moving
the repository to a temporary directory before deleting it, we need
to just sync the move the removal from the parent directory in order
to avoid the issues.
Changelog: fixed
-rw-r--r-- | internal/gitaly/repoutil/remove.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/gitaly/repoutil/remove.go b/internal/gitaly/repoutil/remove.go index 75a2ce998..de3ca7822 100644 --- a/internal/gitaly/repoutil/remove.go +++ b/internal/gitaly/repoutil/remove.go @@ -84,6 +84,10 @@ func Remove( return structerr.NewInternal("staging repository for removal: %w", err) } + if err := safe.NewSyncer().SyncParent(path); err != nil { + return fmt.Errorf("sync removal: %w", err) + } + if err := os.RemoveAll(destDir); err != nil { return structerr.NewInternal("removing repository: %w", err) } |