FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fixed commit.count method which now handles the paths case properly. … · og-python-scripts/GitPython@4114d19 · GitHub

Repository navigation

Commit 4114d19

Browse files
committed
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
1 parent 1da7444 commit 4114d19

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎lib/git/objects/commit.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ def count(self, paths='', **kwargs):
116116
Returns
117117
int
118118
"""
119-
return len(self.repo.git.rev_list(self.sha, '--', paths, **kwargs).strip().splitlines())
119+
# yes, it makes a difference whether empty paths are given or not in our case
120+
# as the empty paths version will ignore merge commits for some reason.
121+
if paths:
122+
return len(self.repo.git.rev_list(self.sha, '--', paths, **kwargs).splitlines())
123+
else:
124+
return len(self.repo.git.rev_list(self.sha, **kwargs).splitlines())
125+
120126

121127
@property
122128
def name_rev(self):

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL