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(
110
110
head_ref : Option < & str > ,
111
111
head_ref_resolved : Option < & str > ,
112
112
) -> 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
+
113
121
let fetch_timer_ok = {
114
122
if let Some ( last) = service. fetch_timers . read ( ) ?. get ( remote_url) {
115
123
let since = std:: time:: Instant :: now ( ) . duration_since ( * last) ;
Original file line number Diff line number Diff line change 54
54
55
55
$ cd $ {TESTTMP}
56
56
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
+
57
62
Checks the following:
58
63
59
64
1 ) Two different formats for separating origin ref in the remote URL
@@ -130,7 +135,6 @@ Check (2) and (3) but with a branch ref
130
135
| | `-- upstream
131
136
| | `-- real_repo. git
132
137
| | | -- HEAD
133
- | | | -- bb282e9cdc1b972fffd08fd21eead43bc0c83cb8
134
138
| | `-- refs
135
139
| | `-- heads
136
140
| | | -- branch-1
@@ -150,5 +154,5 @@ Check (2) and (3) but with a branch ref
150
154
| -- namespaces
151
155
`-- tags
152
156
153
- 35 directories, 23 files
157
+ 35 directories, 22 files
154
158
You can’t perform that action at this time.
0 commit comments