From 7371f8e3e42c1ac7f62be196293df9ca332d6b7e Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Thu, 12 Feb 2009 22:12:38 -0700 Subject: [PATCH] filter-repo: add counting of objects, as well as commits Signed-off-by: Elijah Newren --- git-filter-repo | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/git-filter-repo b/git-filter-repo index dce6f7b..5ca5875 100755 --- a/git-filter-repo +++ b/git-filter-repo @@ -363,3 +363,9 @@ def get_total_commits(repo): p1 = Popen(["git", "rev-list", "--all"], stdout = PIPE, cwd = repo) p2 = Popen(["wc", "-l"], stdin = p1.stdout, stdout = PIPE) return int(p2.communicate()[0]) + +def get_total_objects(repo): + p1 = Popen(["git", "count-objects", "-v"], stdout = PIPE, cwd = repo) + lines = p1.stdout.read().splitlines() + # Return unpacked objects + packed-objects + return int(lines[0].split()[1]) + int(lines[2].split()[1])