summaryrefslogtreecommitdiff
path: root/src/srht_contrib/services/git.py
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-05-03 19:39:08 -0500
committerChristian Cleberg <[email protected]>2026-05-03 19:39:08 -0500
commitfdfb7831fe7dba6d17a1697c7cbb731fd008ba7b (patch)
treea161d0840809bcdd1f64e5da74fb93b1aea3faaa /src/srht_contrib/services/git.py
parent4390684995c9933f213faec2cb20f39af6d506d2 (diff)
downloadhutch-stats-fdfb7831fe7dba6d17a1697c7cbb731fd008ba7b.tar.gz
hutch-stats-fdfb7831fe7dba6d17a1697c7cbb731fd008ba7b.tar.bz2
hutch-stats-fdfb7831fe7dba6d17a1697c7cbb731fd008ba7b.zip
fix: ensure git crawling accounts for all branches
Diffstat (limited to 'src/srht_contrib/services/git.py')
-rw-r--r--src/srht_contrib/services/git.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/srht_contrib/services/git.py b/src/srht_contrib/services/git.py
index 26b2957..ee5c05c 100644
--- a/src/srht_contrib/services/git.py
+++ b/src/srht_contrib/services/git.py
@@ -22,14 +22,18 @@ logger = logging.getLogger(__name__)
REPOSITORY_LOG_QUERY = """
-query RepositoryLog($username: String!, $repoName: String!, $cursor: Cursor) {
+query RepositoryLog($username: String!, $repoName: String!, $cursor: Cursor, $from: String) {
user(username: $username) {
repository(name: $repoName) {
name
owner {
canonicalName
}
- log(cursor: $cursor) {
+ HEAD {
+ name
+ target
+ }
+ log(cursor: $cursor, from: $from) {
results {
id
shortId
@@ -235,7 +239,12 @@ class GitIngestionService:
owner, repo_name = self._split_repository(actor, repository_name)
data = self.client.execute(
REPOSITORY_LOG_QUERY,
- {"username": owner, "repoName": repo_name, "cursor": state["current_repository"]["cursor"]},
+ {
+ "username": owner,
+ "repoName": repo_name,
+ "cursor": state["current_repository"]["cursor"],
+ "from": "HEAD",
+ },
)
user = data.get("user") or {}
repository = user.get("repository") or {}
@@ -353,7 +362,7 @@ class GitIngestionService:
for _ in range(50):
data = self.client.execute(
REPOSITORY_LOG_QUERY,
- {"username": owner, "repoName": repo_name, "cursor": cursor},
+ {"username": owner, "repoName": repo_name, "cursor": cursor, "from": "HEAD"},
)
user = data.get("user") or {}
repository = user.get("repository") or {}