File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,14 @@ fn fetch_needed(
110110 head_ref : Option < & str > ,
111111 head_ref_resolved : Option < & str > ,
112112) -> Result < bool , FetchError > {
113+ if let Some ( head_ref) = head_ref {
114+ if head_ref != "HEAD" && !head_ref. starts_with ( "refs/" ) {
115+ // If the request is for fetching a sha, don't fetch, as most upstreams
116+ // don't support that. The rev should have been fetched previously by reference.
117+ return Ok ( false ) ;
118+ }
119+ }
120+
113121 let fetch_timer_ok = {
114122 if let Some ( last) = service. fetch_timers . read ( ) ?. get ( remote_url) {
115123 let since = std:: time:: Instant :: now ( ) . duration_since ( * last) ;
Original file line number Diff line number Diff line change 5454
5555 $ cd $ {TESTTMP}
5656
57+ $ git ls-remote http: // localhost: 8002 / real_repo. git | tr ' \t' ' '
58+ bb282e9cdc1b972fffd08fd21eead43bc0c83cb8 HEAD
59+ 36 c6ab9d481503e14a88f783e87f3791aa8cef99 refs/ heads/ branch-1
60+ bb282e9cdc1b972fffd08fd21eead43bc0c83cb8 refs/ heads/ master
61+
5762Checks the following:
5863
59641 ) Two different formats for separating origin ref in the remote URL
@@ -130,7 +135,6 @@ Check (2) and (3) but with a branch ref
130135 | | `-- upstream
131136 | | `-- real_repo. git
132137 | | | -- HEAD
133- | | | -- bb282e9cdc1b972fffd08fd21eead43bc0c83cb8
134138 | | `-- refs
135139 | | `-- heads
136140 | | | -- branch-1
@@ -150,5 +154,5 @@ Check (2) and (3) but with a branch ref
150154 | -- namespaces
151155 `-- tags
152156
153- 35 directories, 23 files
157+ 35 directories, 22 files
154158
You can’t perform that action at this time.
0 commit comments