Skip to content

git.py: Handle concurrent download completions properly

Use os.rename() to rename the cloned temporary repository into place in the source cache, and issue a STATUS message when discarding a duplicate clone, in the case where the same repository is cloned twice in parallel.

The problem with using shutil.move() is that it will create the source directory in a subdirectory of the destination when the destination exists, so it's behavior depends on whether the destination exists.

This shutil.move() behavior has so far hidden the race condition where a duplicate repo is created in a subdirectory, as you need to have three concurrent downloads of the same repo in order to trigger the error.

This fixes issue #503 (closed)

Merge request reports

Loading