Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9347395
D6283.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D6283.diff
View Options
diff --git a/swh/storage/postgresql/storage.py b/swh/storage/postgresql/storage.py
--- a/swh/storage/postgresql/storage.py
+++ b/swh/storage/postgresql/storage.py
@@ -953,12 +953,9 @@
zip(db.snapshot_get_cols, fetched_branches[branches_count])
)["name"]
- if branches:
- return PartialBranches(
- id=snapshot_id, branches=branches, next_branch=next_branch,
- )
-
- return None
+ return PartialBranches(
+ id=snapshot_id, branches=branches, next_branch=next_branch,
+ )
@timed
@db_transaction()
diff --git a/swh/storage/tests/storage_tests.py b/swh/storage/tests/storage_tests.py
--- a/swh/storage/tests/storage_tests.py
+++ b/swh/storage/tests/storage_tests.py
@@ -3639,6 +3639,23 @@
assert sorted(branches) == sorted(expected_branches)
assert partial_branches["next_branch"] is None
+ def test_snapshot_get_branches_from_no_result(self, swh_storage, sample_data):
+ snapshot = Snapshot(
+ branches={
+ b"refs/heads/master": SnapshotBranch(
+ target=sample_data.revision.id, target_type=TargetType.REVISION,
+ ),
+ },
+ )
+ swh_storage.snapshot_add([snapshot])
+
+ partial_branches = swh_storage.snapshot_get_branches(
+ snapshot.id, branches_from=b"s",
+ )
+
+ assert partial_branches is not None
+ assert partial_branches["branches"] == {}
+
def test_snapshot_add_get(self, swh_storage, sample_data):
snapshot = sample_data.snapshot
origin = sample_data.origin
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 5:31 PM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3224423
Attached To
D6283: postgresql: Fix get_snapshot_branches return value for empty search
Event Timeline
Log In to Comment