Skip to content

Commit

Permalink
Fix git:: for git v2 server w/o 'filter' capability
Browse files Browse the repository at this point in the history
Closes #366.
  • Loading branch information
gaborcsardi committed May 30, 2024
1 parent 1ecfde9 commit d348629
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/git-protocol.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ async_git_resolve_ref <- function(url, ref) {
}

attr(result, "protocol") <- if ("version 2" %in% refs$caps) 2 else 1
attr(result, "filter") <- any(grepl("\\bfilter\\b", refs$caps))
result
})

Expand Down Expand Up @@ -384,6 +385,10 @@ async_git_fetch_v1 <- function(url, sha, blobs) {
}

async_git_fetch_v2 <- function(url, sha, blobs) {
# If 'filter' is not supported, then we need to get the blobs
if (!is.null(attr(sha, "filter")) && !attr(sha, "filter")) {
blobs <- TRUE
}
async_git_send_message_v2(
url,
"fetch",
Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/_snaps/git-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
[1] "cefdc0eebcd7f757efb9a80652fd8aaf1a87508e"
attr(,"protocol")
[1] 2
attr(,"filter")
[1] TRUE
$commit
tree
Expand Down Expand Up @@ -664,6 +666,8 @@
[1] "3f3b0b4ee8a0ff4563073924e5fe069da67a6d8b"
attr(,"protocol")
[1] 2
attr(,"filter")
[1] TRUE

---

Expand All @@ -673,6 +677,8 @@
[1] "cefdc0eebcd7f757efb9a80652fd8aaf1a87508e"
attr(,"protocol")
[1] 2
attr(,"filter")
[1] TRUE

---

Expand All @@ -682,6 +688,8 @@
[1] "3f3b0b4ee8a0ff4563073924e5fe069da67a6d8b"
attr(,"protocol")
[1] 2
attr(,"filter")
[1] TRUE

---

Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/_snaps/pillar-1.9.0/type-git.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@
[1] "4cc6312883f2842e948f34a816ce8e846f323a6e"
attr(,"protocol")
[1] 2
attr(,"filter")
[1] TRUE
Expand Down

0 comments on commit d348629

Please sign in to comment.