File tree Expand file tree Collapse file tree 4 files changed +44
-42
lines changed Expand file tree Collapse file tree 4 files changed +44
-42
lines changed Original file line number Diff line number Diff line change 9
9
#include "strvec.h"
10
10
#include "refs.h"
11
11
#include "refspec.h"
12
+ #include "remote.h"
12
13
#include "strbuf.h"
13
14
14
15
/*
@@ -447,3 +448,34 @@ int refspec_find_match(struct refspec *rs, struct refspec_item *query)
447
448
}
448
449
return -1 ;
449
450
}
451
+
452
+ struct ref * apply_negative_refspecs (struct ref * ref_map , struct refspec * rs )
453
+ {
454
+ struct ref * * tail ;
455
+
456
+ for (tail = & ref_map ; * tail ; ) {
457
+ struct ref * ref = * tail ;
458
+
459
+ if (refname_matches_negative_refspec_item (ref -> name , rs )) {
460
+ * tail = ref -> next ;
461
+ free (ref -> peer_ref );
462
+ free (ref );
463
+ } else
464
+ tail = & ref -> next ;
465
+ }
466
+
467
+ return ref_map ;
468
+ }
469
+
470
+ char * apply_refspecs (struct refspec * rs , const char * name )
471
+ {
472
+ struct refspec_item query ;
473
+
474
+ memset (& query , 0 , sizeof (struct refspec_item ));
475
+ query .src = (char * )name ;
476
+
477
+ if (refspec_find_match (rs , & query ))
478
+ return NULL ;
479
+
480
+ return query .dst ;
481
+ }
Original file line number Diff line number Diff line change @@ -96,4 +96,16 @@ void refspec_find_all_matches(struct refspec *rs,
96
96
struct refspec_item * query ,
97
97
struct string_list * results );
98
98
99
+ /*
100
+ * Remove all entries in the input list which match any negative refspec in
101
+ * the refspec list.
102
+ */
103
+ struct ref * apply_negative_refspecs (struct ref * ref_map , struct refspec * rs );
104
+
105
+ /*
106
+ * Search for a refspec that matches the given name and return the
107
+ * corresponding destination (dst) if a match is found, NULL otherwise.
108
+ */
109
+ char * apply_refspecs (struct refspec * rs , const char * name );
110
+
99
111
#endif /* REFSPEC_H */
Original file line number Diff line number Diff line change @@ -907,37 +907,6 @@ void ref_push_report_free(struct ref_push_report *report)
907
907
}
908
908
}
909
909
910
- struct ref * apply_negative_refspecs (struct ref * ref_map , struct refspec * rs )
911
- {
912
- struct ref * * tail ;
913
-
914
- for (tail = & ref_map ; * tail ; ) {
915
- struct ref * ref = * tail ;
916
-
917
- if (refname_matches_negative_refspec_item (ref -> name , rs )) {
918
- * tail = ref -> next ;
919
- free (ref -> peer_ref );
920
- free (ref );
921
- } else
922
- tail = & ref -> next ;
923
- }
924
-
925
- return ref_map ;
926
- }
927
-
928
- char * apply_refspecs (struct refspec * rs , const char * name )
929
- {
930
- struct refspec_item query ;
931
-
932
- memset (& query , 0 , sizeof (struct refspec_item ));
933
- query .src = (char * )name ;
934
-
935
- if (refspec_find_match (rs , & query ))
936
- return NULL ;
937
-
938
- return query .dst ;
939
- }
940
-
941
910
int remote_find_tracking (struct remote * remote , struct refspec_item * refspec )
942
911
{
943
912
return refspec_find_match (& remote -> fetch , refspec );
Original file line number Diff line number Diff line change @@ -261,17 +261,6 @@ int resolve_remote_symref(struct ref *ref, struct ref *list);
261
261
*/
262
262
struct ref * ref_remove_duplicates (struct ref * ref_map );
263
263
264
- int refname_matches_negative_refspec_item (const char * refname , struct refspec * rs );
265
-
266
- /*
267
- * Remove all entries in the input list which match any negative refspec in
268
- * the refspec list.
269
- */
270
- struct ref * apply_negative_refspecs (struct ref * ref_map , struct refspec * rs );
271
-
272
- int refspec_find_match (struct refspec * rs , struct refspec_item * query );
273
- char * apply_refspecs (struct refspec * rs , const char * name );
274
-
275
264
int check_push_refs (struct ref * src , struct refspec * rs );
276
265
int match_push_refs (struct ref * src , struct ref * * dst ,
277
266
struct refspec * rs , int flags );
You can’t perform that action at this time.
0 commit comments