Skip to content
Snippets Groups Projects
Commit b82c6393 authored by Sami Hiltunen's avatar Sami Hiltunen
Browse files

Remove repository even if there is a failed deletion

The Remove function removes a repository. It does so by first moving
the repository into a temporary directory and only then removing the
repository. This is done to avoid leaving partially deleted repositories
behind if the deletion is interrupted. The temporary directory is named
based on the last element of the repository's path. This can lead to
issues if the deletion wasn't performed to completion prior to the next
deletion happening for the same relative path as the temporary directory
name of the latter deletion conflicts with the former one's. Fix this by
adding a random element to the temporary directory name so multiple
deletions for the same relative path can be performed without conflicts.

As we're using MkdirTemp to create a unique directory, we're removing
the repository in a deferred function to ensure its removal in all of the
error branches. This makes no real difference given the removal effectively
happens when the repository is renamed to the temporary directory.

Changelog: fixed
parent 92e441aa
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment