@@ -269,28 +269,28 @@ void refspec_ref_prefixes(const struct refspec *rs,
269
269
}
270
270
}
271
271
272
- int match_name_with_pattern (const char * key , const char * name ,
273
- const char * value , char * * result )
272
+ int match_refname_with_pattern (const char * pattern , const char * refname ,
273
+ const char * replacement , char * * result )
274
274
{
275
- const char * kstar = strchr (key , '*' );
275
+ const char * kstar = strchr (pattern , '*' );
276
276
size_t klen ;
277
277
size_t ksuffixlen ;
278
278
size_t namelen ;
279
279
int ret ;
280
280
if (!kstar )
281
- die (_ ("key '%s' of pattern had no '*'" ), key );
282
- klen = kstar - key ;
281
+ die (_ ("pattern '%s' has no '*'" ), pattern );
282
+ klen = kstar - pattern ;
283
283
ksuffixlen = strlen (kstar + 1 );
284
- namelen = strlen (name );
285
- ret = !strncmp (name , key , klen ) && namelen >= klen + ksuffixlen &&
286
- !memcmp (name + namelen - ksuffixlen , kstar + 1 , ksuffixlen );
287
- if (ret && value ) {
284
+ namelen = strlen (refname );
285
+ ret = !strncmp (refname , pattern , klen ) && namelen >= klen + ksuffixlen &&
286
+ !memcmp (refname + namelen - ksuffixlen , kstar + 1 , ksuffixlen );
287
+ if (ret && replacement ) {
288
288
struct strbuf sb = STRBUF_INIT ;
289
- const char * vstar = strchr (value , '*' );
289
+ const char * vstar = strchr (replacement , '*' );
290
290
if (!vstar )
291
- die (_ ("value '%s' of pattern has no '*'" ), value );
292
- strbuf_add (& sb , value , vstar - value );
293
- strbuf_add (& sb , name + klen , namelen - klen - ksuffixlen );
291
+ die (_ ("replacement '%s' has no '*'" ), replacement );
292
+ strbuf_add (& sb , replacement , vstar - replacement );
293
+ strbuf_add (& sb , refname + klen , namelen - klen - ksuffixlen );
294
294
strbuf_addstr (& sb , vstar + 1 );
295
295
* result = strbuf_detach (& sb , NULL );
296
296
}
@@ -301,7 +301,7 @@ static int refspec_match(const struct refspec_item *refspec,
301
301
const char * name )
302
302
{
303
303
if (refspec -> pattern )
304
- return match_name_with_pattern (refspec -> src , name , NULL , NULL );
304
+ return match_refname_with_pattern (refspec -> src , name , NULL , NULL );
305
305
306
306
return !strcmp (refspec -> src , name );
307
307
}
@@ -352,7 +352,7 @@ static int refspec_find_negative_match(struct refspec *rs, struct refspec_item *
352
352
const char * key = refspec -> dst ? refspec -> dst : refspec -> src ;
353
353
const char * value = refspec -> src ;
354
354
355
- if (match_name_with_pattern (key , needle , value , & expn_name ))
355
+ if (match_refname_with_pattern (key , needle , value , & expn_name ))
356
356
string_list_append_nodup (& reversed , expn_name );
357
357
} else if (refspec -> matching ) {
358
358
/* For the special matching refspec, any query should match */
@@ -397,7 +397,7 @@ void refspec_find_all_matches(struct refspec *rs,
397
397
if (!refspec -> dst || refspec -> negative )
398
398
continue ;
399
399
if (refspec -> pattern ) {
400
- if (match_name_with_pattern (key , needle , value , result ))
400
+ if (match_refname_with_pattern (key , needle , value , result ))
401
401
string_list_append_nodup (results , * result );
402
402
} else if (!strcmp (needle , key )) {
403
403
string_list_append (results , value );
@@ -426,7 +426,7 @@ int refspec_find_match(struct refspec *rs, struct refspec_item *query)
426
426
if (!refspec -> dst || refspec -> negative )
427
427
continue ;
428
428
if (refspec -> pattern ) {
429
- if (match_name_with_pattern (key , needle , value , result )) {
429
+ if (match_refname_with_pattern (key , needle , value , result )) {
430
430
query -> force = refspec -> force ;
431
431
return 0 ;
432
432
}
0 commit comments