@@ -138,6 +138,11 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)
138
138
}
139
139
}
140
140
141
+ static const char * rsync_url (const char * url )
142
+ {
143
+ return prefixcmp (url , "rsync://" ) ? skip_prefix (url , "rsync:" ) : url ;
144
+ }
145
+
141
146
static struct ref * get_refs_via_rsync (struct transport * transport )
142
147
{
143
148
struct strbuf buf = STRBUF_INIT , temp_dir = STRBUF_INIT ;
@@ -153,7 +158,7 @@ static struct ref *get_refs_via_rsync(struct transport *transport)
153
158
die ("Could not make temporary directory" );
154
159
temp_dir_len = temp_dir .len ;
155
160
156
- strbuf_addstr (& buf , transport -> url );
161
+ strbuf_addstr (& buf , rsync_url ( transport -> url ) );
157
162
strbuf_addstr (& buf , "/refs" );
158
163
159
164
memset (& rsync , 0 , sizeof (rsync ));
@@ -169,7 +174,7 @@ static struct ref *get_refs_via_rsync(struct transport *transport)
169
174
die ("Could not run rsync to get refs" );
170
175
171
176
strbuf_reset (& buf );
172
- strbuf_addstr (& buf , transport -> url );
177
+ strbuf_addstr (& buf , rsync_url ( transport -> url ) );
173
178
strbuf_addstr (& buf , "/packed-refs" );
174
179
175
180
args [2 ] = buf .buf ;
@@ -206,7 +211,7 @@ static int fetch_objs_via_rsync(struct transport *transport,
206
211
const char * args [8 ];
207
212
int result ;
208
213
209
- strbuf_addstr (& buf , transport -> url );
214
+ strbuf_addstr (& buf , rsync_url ( transport -> url ) );
210
215
strbuf_addstr (& buf , "/objects/" );
211
216
212
217
memset (& rsync , 0 , sizeof (rsync ));
@@ -285,7 +290,7 @@ static int rsync_transport_push(struct transport *transport,
285
290
286
291
/* first push the objects */
287
292
288
- strbuf_addstr (& buf , transport -> url );
293
+ strbuf_addstr (& buf , rsync_url ( transport -> url ) );
289
294
strbuf_addch (& buf , '/' );
290
295
291
296
memset (& rsync , 0 , sizeof (rsync ));
@@ -306,7 +311,8 @@ static int rsync_transport_push(struct transport *transport,
306
311
args [i ++ ] = NULL ;
307
312
308
313
if (run_command (& rsync ))
309
- return error ("Could not push objects to %s" , transport -> url );
314
+ return error ("Could not push objects to %s" ,
315
+ rsync_url (transport -> url ));
310
316
311
317
/* copy the refs to the temporary directory; they could be packed. */
312
318
@@ -327,10 +333,11 @@ static int rsync_transport_push(struct transport *transport,
327
333
if (!(flags & TRANSPORT_PUSH_FORCE ))
328
334
args [i ++ ] = "--ignore-existing" ;
329
335
args [i ++ ] = temp_dir .buf ;
330
- args [i ++ ] = transport -> url ;
336
+ args [i ++ ] = rsync_url ( transport -> url ) ;
331
337
args [i ++ ] = NULL ;
332
338
if (run_command (& rsync ))
333
- result = error ("Could not push to %s" , transport -> url );
339
+ result = error ("Could not push to %s" ,
340
+ rsync_url (transport -> url ));
334
341
335
342
if (remove_dir_recursively (& temp_dir , 0 ))
336
343
warning ("Could not remove temporary directory %s." ,
@@ -723,7 +730,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
723
730
ret -> remote = remote ;
724
731
ret -> url = url ;
725
732
726
- if (!prefixcmp (url , "rsync:// " )) {
733
+ if (!prefixcmp (url , "rsync:" )) {
727
734
ret -> get_refs_list = get_refs_via_rsync ;
728
735
ret -> fetch = fetch_objs_via_rsync ;
729
736
ret -> push = rsync_transport_push ;
0 commit comments