diff options
Diffstat (limited to 'lib/git')
-rw-r--r-- | lib/git/commit.py | 8 | ||||
-rw-r--r-- | lib/git/repo.py | 11 |
2 files changed, 9 insertions, 10 deletions
diff --git a/lib/git/commit.py b/lib/git/commit.py index 8b7bdfa8..c50d9d2d 100644 --- a/lib/git/commit.py +++ b/lib/git/commit.py @@ -95,7 +95,7 @@ class Commit(LazyMixin): Returns int """ - return len(repo.git.rev_list(ref).strip().splitlines()) + return len(repo.git.rev_list(ref, '--').strip().splitlines()) @classmethod def find_all(cls, repo, ref, **kwargs): @@ -118,7 +118,7 @@ class Commit(LazyMixin): options = {'pretty': 'raw'} options.update(kwargs) - output = repo.git.rev_list(ref, **options) + output = repo.git.rev_list(ref, '--', **options) return cls.list_from_string(repo, output) @classmethod @@ -214,14 +214,14 @@ class Commit(LazyMixin): @property def stats(self): if not self.parents: - text = self.repo.git.diff(self.id, numstat=True) + text = self.repo.git.diff(self.id, '--', numstat=True) text2 = "" for line in text.splitlines(): (insertions, deletions, filename) = line.split("\t") text2 += "%s\t%s\t%s\n" % (deletions, insertions, filename) text = text2 else: - text = self.repo.git.diff(self.parents[0].id, self.id, numstat=True) + text = self.repo.git.diff(self.parents[0].id, self.id, '--', numstat=True) return stats.Stats.list_from_string(self.repo, text) def __str__(self): 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): |