Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5ac93b1

Browse files
committed
Use uuid instead of tempfile.mkdtmp, which created an actual directory.
That, over time, could have caused slow downs due to file-system hassle. Fixes gitpython-developers#258
1 parent f51fe3e commit 5ac93b1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

git/objects/submodule/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
import os
3939
import logging
40-
import tempfile
40+
import uuid
4141

4242
__all__ = ["Submodule", "UpdateProgress"]
4343

@@ -992,7 +992,7 @@ def rename(self, new_name):
992992
source_dir = mod.git_dir
993993
# Let's be sure the submodule name is not so obviously tied to a directory
994994
if destination_module_abspath.startswith(mod.git_dir):
995-
tmp_dir = self._module_abspath(self.repo, self.path, os.path.basename(tempfile.mkdtemp()))
995+
tmp_dir = self._module_abspath(self.repo, self.path, str(uuid.uuid4()))
996996
os.renames(source_dir, tmp_dir)
997997
source_dir = tmp_dir
998998
# end handle self-containment

0 commit comments

Comments
 (0)