Changeset 8a2f5cefc032…
Parent c1c8d0dd7add…
by
Changes to 4 files · Browse files at 8a2f5cefc032 Showing diff from parent c1c8d0dd7add Diff from another changeset...
@@ -8,6 +8,9 @@
* Fix get_transport_and_path compatibility with pre-2.6.5 versions of Python.
(Max Bowsher, #707438)
+
+ * BaseObjectStore.determine_wants_all no longer breaks on zero SHAs.
+ (Jelmer Vernooij)
IMPROVEMENTS
|
@@ -40,6 +40,7 @@ ShaFile,
Tag,
Tree,
+ ZERO_SHA,
hex_to_sha,
sha_to_hex,
hex_to_filename,
@@ -66,7 +67,8 @@
def determine_wants_all(self, refs):
return [sha for (ref, sha) in refs.iteritems()
- if not sha in self and not ref.endswith("^{}")]
+ if not sha in self and not ref.endswith("^{}") and
+ not sha == ZERO_SHA]
def iter_shas(self, shas):
"""Iterate over the objects for the specified shas.
|
@@ -43,6 +43,7 @@ TreeEntryTuple,
)
+ZERO_SHA = "0" * 40
# Header fields for commits
_TREE_HEADER = "tree"
|
@@ -57,6 +57,14 @@
class ObjectStoreTests(object):
+ def test_determine_wants_all(self):
+ self.assertEquals(["1" * 40],
+ self.store.determine_wants_all({"refs/heads/foo": "1" * 40}))
+
+ def test_determine_wants_all_zero(self):
+ self.assertEquals([],
+ self.store.determine_wants_all({"refs/heads/foo": "0" * 40}))
+
def test_iter(self):
self.assertEquals([], list(self.store))
|
Loading...