Skip to content

Commit 872d4ba

Browse files
author
alexandresalome
committed
do not fetch all commit hashes, only the count
1 parent adfc190 commit 872d4ba

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Gitonomy/Git/Log.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,11 @@ public function getIterator()
223223
public function countCommits()
224224
{
225225
if (count($this->revisions)) {
226-
$output = $this->repository->run('rev-list', array_merge($this->revisions->getAsTextArray(), array('--'), $this->paths));
226+
$output = $this->repository->run('rev-list', array_merge(array('--count'), $this->revisions->getAsTextArray(), array('--'), $this->paths));
227227
} else {
228-
$output = $this->repository->run('rev-list', array_merge(array('--all', '--'), $this->paths));
228+
$output = $this->repository->run('rev-list', array_merge(array('--count', '--all', '--'), $this->paths));
229229
}
230230

231-
return count(explode("\n", $output)) - 1;
231+
return (int) $output;
232232
}
233233
}

0 commit comments

Comments
 (0)