From 4114d19e2c02f3ffca9feb07b40d9475f36604cc Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 6 Nov 2009 11:09:14 +0100 Subject: Fixed commit.count method which now handles the paths case properly. It appears git-rev-list uses empty paths in some way, which is quite hard to specify on a shell, but easy if the process is spawned directly --- lib/git/objects/commit.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/git/objects/commit.py') diff --git a/lib/git/objects/commit.py b/lib/git/objects/commit.py index 80b3ad23..4ec806fb 100644 --- a/lib/git/objects/commit.py +++ b/lib/git/objects/commit.py @@ -116,7 +116,13 @@ class Commit(base.Object, Iterable, diff.Diffable): Returns int """ - return len(self.repo.git.rev_list(self.sha, '--', paths, **kwargs).strip().splitlines()) + # yes, it makes a difference whether empty paths are given or not in our case + # as the empty paths version will ignore merge commits for some reason. + if paths: + return len(self.repo.git.rev_list(self.sha, '--', paths, **kwargs).splitlines()) + else: + return len(self.repo.git.rev_list(self.sha, **kwargs).splitlines()) + @property def name_rev(self): -- cgit v1.2.1