diff options
Diffstat (limited to 'git/objects')
| -rw-r--r-- | git/objects/commit.py | 7 | ||||
| -rw-r--r-- | git/objects/submodule/base.py | 19 | ||||
| -rw-r--r-- | git/objects/util.py | 2 |
3 files changed, 17 insertions, 11 deletions
diff --git a/git/objects/commit.py b/git/objects/commit.py index b9718694..f13760fd 100644 --- a/git/objects/commit.py +++ b/git/objects/commit.py @@ -189,9 +189,12 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): if 'pretty' in kwargs: raise ValueError("--pretty cannot be used as parsing expects single sha's only") # END handle pretty - args = list() + + # use -- in any case, to prevent possibility of ambiguous arguments + # see https://github.com/gitpython-developers/GitPython/issues/264 + args = ['--'] if paths: - args.extend(('--', paths)) + args.extend((paths, )) # END if paths proc = repo.git.rev_list(rev, args, as_process=True, **kwargs) 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 diff --git a/git/objects/util.py b/git/objects/util.py index cefef862..567b1d5b 100644 --- a/git/objects/util.py +++ b/git/objects/util.py @@ -216,7 +216,7 @@ class ProcessStreamAdapter(object): class Traversable(object): - """Simple interface to perforam depth-first or breadth-first traversals + """Simple interface to perform depth-first or breadth-first traversals into one direction. Subclasses only need to implement one function. Instances of the Subclass must be hashable""" |
