Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7066488
D6401.id23277.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D6401.id23277.diff
View Options
diff --git a/swh/loader/git/tests/test_from_disk.py b/swh/loader/git/tests/test_from_disk.py
--- a/swh/loader/git/tests/test_from_disk.py
+++ b/swh/loader/git/tests/test_from_disk.py
@@ -336,13 +336,13 @@
)
def test_load_filter_branches(self):
- filtered_branches = {b"refs/pull/42/merge"}
- unfiltered_branches = {b"refs/pull/42/head"}
+ filtered_branches = {b"refs/pull/42/merge", b"refs/pull/42/head"}
+ unfiltered_branches = {b"refs/heads/branch1"}
# Add branches to the repository on disk; some should be filtered by
# the loader, some should not.
for branch_name in filtered_branches | unfiltered_branches:
- self.repo[branch_name] = self.repo[b"refs/heads/master"]
+ self.repo[branch_name] = self.repo[b"refs/heads/branch1"]
# Generate the expected snapshot from SNAPSHOT1 (which is the original
# state of the git repo)...
@@ -351,7 +351,7 @@
# ... and the unfiltered_branches, which are all pointing to the same
# commit as "refs/heads/master".
for branch_name in unfiltered_branches:
- branches[branch_name] = branches[b"refs/heads/master"]
+ branches[branch_name] = branches[b"refs/heads/branch1"]
expected_snapshot = Snapshot(branches=branches)
diff --git a/swh/loader/git/tests/test_utils.py b/swh/loader/git/tests/test_utils.py
--- a/swh/loader/git/tests/test_utils.py
+++ b/swh/loader/git/tests/test_utils.py
@@ -43,12 +43,4 @@
actual_branches = {b for b in branches if not utils.ignore_branch_name(b)}
- assert actual_branches == set(
- [
- b"HEAD",
- b"refs/heads/master",
- b"refs/{}",
- b"refs/pull/10/head",
- b"refs/pull/100/head",
- ]
- )
+ assert actual_branches == set([b"HEAD", b"refs/heads/master", b"refs/{}",])
diff --git a/swh/loader/git/utils.py b/swh/loader/git/utils.py
--- a/swh/loader/git/utils.py
+++ b/swh/loader/git/utils.py
@@ -86,8 +86,8 @@
if branch_name.endswith(b"^{}"):
# Peeled refs make the git protocol explode
return True
- elif branch_name.startswith(b"refs/pull/") and branch_name.endswith(b"/merge"):
- # We filter-out auto-merged GitHub pull requests
+ elif branch_name.startswith(b"refs/pull/"):
+ # We filter-out pull requests related branches
return True
return False
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Nov 5 2024, 11:58 AM (12 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3219812
Attached To
D6401: Filter out pull request related branches
Event Timeline
Log In to Comment