mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-07-06 18:32:14 +02:00
filter-repo: avoid depending on wc
binary being present
rev-list already has --count option anyway, so piping output to wc -l to count the number of lines was a total waste of time. Plus, it might cause failures for the testsuite on some Windows boxes. Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
parent
cf67ccd978
commit
d2fdc89ff3
@ -1496,16 +1496,13 @@ class GitUtils(object):
|
|||||||
args = ['--all']
|
args = ['--all']
|
||||||
if len(args) == 1 and isinstance(args[0], list):
|
if len(args) == 1 and isinstance(args[0], list):
|
||||||
args = args[0]
|
args = args[0]
|
||||||
p1 = subproc.Popen(["git", "rev-list"] + args,
|
p = subproc.Popen(["git", "rev-list", "--count"] + args,
|
||||||
bufsize=-1,
|
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||||
cwd=repo)
|
cwd=repo)
|
||||||
p2 = subproc.Popen(["wc", "-l"], stdin=p1.stdout, stdout=subprocess.PIPE)
|
if p.wait() != 0:
|
||||||
count = int(p2.communicate()[0])
|
|
||||||
if p1.poll() != 0:
|
|
||||||
raise SystemExit(_("%s does not appear to be a valid git repository")
|
raise SystemExit(_("%s does not appear to be a valid git repository")
|
||||||
% decode(repo))
|
% decode(repo))
|
||||||
return count
|
return int(p.stdout.read())
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_total_objects(repo):
|
def get_total_objects(repo):
|
||||||
|
Loading…
Reference in New Issue
Block a user