]> arthur.barton.de Git - bup.git/commitdiff
rev_list: check count type more carefully
authorRob Browning <rlb@defaultvalue.org>
Sun, 2 Jul 2017 16:20:18 +0000 (11:20 -0500)
committerRob Browning <rlb@defaultvalue.org>
Thu, 21 Sep 2017 02:12:48 +0000 (21:12 -0500)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/git.py

index c632631c03edf2f504defba023b6704287d14eb7..3f4cbaf567d39fc27a3ff039cc36b3994768df01 100644 (file)
@@ -6,6 +6,7 @@ interact with the Git data structures.
 import errno, os, sys, zlib, time, subprocess, struct, stat, re, tempfile, glob
 from collections import namedtuple
 from itertools import islice
+from numbers import Integral
 
 from bup import _helpers, hashsplit, path, midx, bloom, xstat
 from bup.helpers import (Sha1, add_error, chunkyreader, debug1, debug2,
@@ -933,8 +934,10 @@ def rev_list(ref, count=None, repo_dir=None):
     """
     assert(not ref.startswith('-'))
     opts = []
-    if count:
-        opts += ['-n', str(atoi(count))]
+    if isinstance(count, Integral):
+        opts += ['-n', str(count)]
+    else:
+        assert not count
     argv = ['git', 'rev-list', '--pretty=format:%at'] + opts + [ref, '--']
     p = subprocess.Popen(argv,
                          preexec_fn = _gitenv(repo_dir),