Skip to content

Commit

Permalink
Revert "Don't forward fetches with sha in want (#1313)"
Browse files Browse the repository at this point in the history
This reverts commit a22ab2a.
  • Loading branch information
christian-schilling authored May 17, 2024
1 parent b28d490 commit ce3cafd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
8 changes: 0 additions & 8 deletions josh-proxy/src/bin/josh-proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,6 @@ fn fetch_needed(
head_ref: Option<&str>,
head_ref_resolved: Option<&str>,
) -> Result<bool, FetchError> {
if let Some(head_ref) = head_ref {
if head_ref != "HEAD" && !head_ref.starts_with("refs/") {
// If the request is for fetching a sha, don't fetch, as most upstreams
// don't support that. The rev should have been fetched previously by reference.
return Ok(false);
}
}

let fetch_timer_ok = {
if let Some(last) = service.fetch_timers.read()?.get(remote_url) {
let since = std::time::Instant::now().duration_since(*last);
Expand Down
8 changes: 2 additions & 6 deletions tests/proxy/clone_sha.t
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@

$ cd ${TESTTMP}

$ git ls-remote http://localhost:8002/real_repo.git | tr '\t' ' '
bb282e9cdc1b972fffd08fd21eead43bc0c83cb8 HEAD
36c6ab9d481503e14a88f783e87f3791aa8cef99 refs/heads/branch-1
bb282e9cdc1b972fffd08fd21eead43bc0c83cb8 refs/heads/master

Checks the following:

1) Two different formats for separating origin ref in the remote URL
Expand Down Expand Up @@ -135,6 +130,7 @@ Check (2) and (3) but with a branch ref
| | `-- upstream
| | `-- real_repo.git
| | |-- HEAD
| | |-- bb282e9cdc1b972fffd08fd21eead43bc0c83cb8
| | `-- refs
| | `-- heads
| | |-- branch-1
Expand All @@ -154,5 +150,5 @@ Check (2) and (3) but with a branch ref
|-- namespaces
`-- tags

35 directories, 22 files
35 directories, 23 files

0 comments on commit ce3cafd

Please sign in to comment.