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
Please register or sign in to comment