@@ -1312,7 +1312,7 @@ int check_push_refs(struct ref *src, int nr_refspec, const char **refspec_names)
1312
1312
int match_push_refs (struct ref * src , struct ref * * dst ,
1313
1313
int nr_refspec , const char * * refspec , int flags )
1314
1314
{
1315
- struct refspec_item * rs ;
1315
+ struct refspec rs = REFSPEC_INIT_PUSH ;
1316
1316
int send_all = flags & MATCH_REFS_ALL ;
1317
1317
int send_mirror = flags & MATCH_REFS_MIRROR ;
1318
1318
int send_prune = flags & MATCH_REFS_PRUNE ;
@@ -1325,8 +1325,8 @@ int match_push_refs(struct ref *src, struct ref **dst,
1325
1325
nr_refspec = 1 ;
1326
1326
refspec = default_refspec ;
1327
1327
}
1328
- rs = parse_push_refspec ( nr_refspec , ( const char * * ) refspec );
1329
- errs = match_explicit_refs (src , * dst , & dst_tail , rs , nr_refspec );
1328
+ refspec_appendn ( & rs , refspec , nr_refspec );
1329
+ errs = match_explicit_refs (src , * dst , & dst_tail , rs . items , rs . nr );
1330
1330
1331
1331
/* pick the remainder */
1332
1332
for (ref = src ; ref ; ref = ref -> next ) {
@@ -1335,7 +1335,7 @@ int match_push_refs(struct ref *src, struct ref **dst,
1335
1335
const struct refspec_item * pat = NULL ;
1336
1336
char * dst_name ;
1337
1337
1338
- dst_name = get_ref_match (rs , nr_refspec , ref , send_mirror , FROM_SRC , & pat );
1338
+ dst_name = get_ref_match (rs . items , rs . nr , ref , send_mirror , FROM_SRC , & pat );
1339
1339
if (!dst_name )
1340
1340
continue ;
1341
1341
@@ -1384,7 +1384,7 @@ int match_push_refs(struct ref *src, struct ref **dst,
1384
1384
/* We're already sending something to this ref. */
1385
1385
continue ;
1386
1386
1387
- src_name = get_ref_match (rs , nr_refspec , ref , send_mirror , FROM_DST , NULL );
1387
+ src_name = get_ref_match (rs . items , rs . nr , ref , send_mirror , FROM_DST , NULL );
1388
1388
if (src_name ) {
1389
1389
if (!src_ref_index .nr )
1390
1390
prepare_ref_index (& src_ref_index , src );
@@ -1396,6 +1396,9 @@ int match_push_refs(struct ref *src, struct ref **dst,
1396
1396
}
1397
1397
string_list_clear (& src_ref_index , 0 );
1398
1398
}
1399
+
1400
+ refspec_clear (& rs );
1401
+
1399
1402
if (errs )
1400
1403
return -1 ;
1401
1404
return 0 ;
0 commit comments