diff options
author | Paul Sowden <paul@idontsmoke.co.uk> | 2008-11-19 23:03:54 -0800 |
---|---|---|
committer | Michael Trier <mtrier@gmail.com> | 2008-12-15 14:06:03 -0500 |
commit | 5bb812243dd1815651281a54c8191fc8e2bc2d82 (patch) | |
tree | ce472b595fa84369fc34fc0051894f4e9d701b9c /lib/git/repo.py | |
parent | 5117c9c8a4d3af19a9958677e45cda9269de1541 (diff) | |
download | gitpython-5bb812243dd1815651281a54c8191fc8e2bc2d82.tar.gz |
remove ambiguity between paths and treeishs
When calling commands that accept treeish and path arguments and there is a path with the same name as a treeish git cowardly refuses to pick one and asks for the command to use the unambiguous syntax where '--' seperates the treeish from the paths. Add '--' to the git commands to indicate that the argument is a treeish and not a path.
(cherry picked from commit a9a57fa93a2b121ab9b17fcd6062b9a9c9740883)
Diffstat (limited to 'lib/git/repo.py')
-rw-r--r-- | lib/git/repo.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/git/repo.py b/lib/git/repo.py index a3874259..09215b1e 100644 --- a/lib/git/repo.py +++ b/lib/git/repo.py @@ -192,8 +192,8 @@ class Repo(object): Returns ``git.Commit[]`` """ - repo_refs = self.git.rev_list(ref).strip().splitlines() - other_repo_refs = other_repo.git.rev_list(other_ref).strip().splitlines() + repo_refs = self.git.rev_list(ref, '--').strip().splitlines() + other_repo_refs = other_repo.git.rev_list(other_ref, '--').strip().splitlines() diff_refs = list(set(other_repo_refs) - set(repo_refs)) return map(lambda ref: Commit.find_all(other_repo, ref, max_count=1)[0], diff_refs) @@ -236,10 +236,9 @@ class Repo(object): """ options = {'pretty': 'raw'} options.update(kwargs) + arg = [commit, '--'] if path: - arg = [commit, '--', path] - else: - arg = [commit] + arg.append(path) commits = self.git.log(*arg, **options) return Commit.list_from_string(self, commits) @@ -450,7 +449,7 @@ class Repo(object): # always consired to be clean. return False - return len(self.git.diff('HEAD').strip()) > 0 + return len(self.git.diff('HEAD', '--').strip()) > 0 @property def active_branch(self): |