aboutsummaryrefslogtreecommitdiff
path: root/git/objects/submodule/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'git/objects/submodule/base.py')
-rw-r--r--git/objects/submodule/base.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py
index be243acc..f9b0b6ad 100644
--- a/git/objects/submodule/base.py
+++ b/git/objects/submodule/base.py
@@ -37,7 +37,7 @@ import git
import os
import logging
-import tempfile
+import uuid
__all__ = ["Submodule", "UpdateProgress"]
@@ -136,7 +136,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
@classmethod
def _need_gitfile_submodules(cls, git):
- return git.version_info[:3] >= (1, 8, 0)
+ return git.version_info[:3] >= (1, 7, 0)
def __eq__(self, other):
"""Compare with another submodule"""
@@ -293,7 +293,8 @@ class Submodule(util.IndexObject, Iterable, Traversable):
fp.close()
writer = GitConfigParser(os.path.join(module_abspath, 'config'), read_only=False, merge_includes=False)
- writer.set_value('core', 'worktree', os.path.relpath(working_tree_dir, start=module_abspath))
+ writer.set_value('core', 'worktree',
+ to_native_path_linux(os.path.relpath(working_tree_dir, start=module_abspath)))
writer.release()
#{ Edit Interface
@@ -578,11 +579,13 @@ class Submodule(util.IndexObject, Iterable, Traversable):
base_commit = mrepo.merge_base(mrepo.head.commit, hexsha)
if len(base_commit) == 0 or base_commit[0].hexsha == hexsha:
if force:
- log.debug("Will force checkout or reset on local branch that is possibly in the future of"
- + "the commit it will be checked out to, effectively 'forgetting' new commits")
+ msg = "Will force checkout or reset on local branch that is possibly in the future of"
+ msg += "the commit it will be checked out to, effectively 'forgetting' new commits"
+ log.debug(msg)
else:
- log.info("Skipping %s on branch '%s' of submodule repo '%s' as it contains "
- + "un-pushed commits", is_detached and "checkout" or "reset", mrepo.head, mrepo)
+ msg = "Skipping %s on branch '%s' of submodule repo '%s' as it contains un-pushed commits"
+ msg %= (is_detached and "checkout" or "reset", mrepo.head, mrepo)
+ log.info(msg)
may_reset = False
# end handle force
# end handle if we are in the future
@@ -992,7 +995,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
source_dir = mod.git_dir
# Let's be sure the submodule name is not so obviously tied to a directory
if destination_module_abspath.startswith(mod.git_dir):
- tmp_dir = self._module_abspath(self.repo, self.path, os.path.basename(tempfile.mkdtemp()))
+ tmp_dir = self._module_abspath(self.repo, self.path, str(uuid.uuid4()))
os.renames(source_dir, tmp_dir)
source_dir = tmp_dir
# end handle self-containment