File tree Expand file tree Collapse file tree 4 files changed +44
-39
lines changed
Expand file tree Collapse file tree 4 files changed +44
-39
lines changed Original file line number Diff line number Diff line change 99#include "strvec.h"
1010#include "refs.h"
1111#include "refspec.h"
12+ #include "remote.h"
1213#include "strbuf.h"
1314
1415/*
@@ -447,3 +448,34 @@ int query_refspecs(struct refspec *rs, struct refspec_item *query)
447448 }
448449 return -1 ;
449450}
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 (omit_name_by_refspec (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 (query_refspecs (rs , & query ))
478+ return NULL ;
479+
480+ return query .dst ;
481+ }
Original file line number Diff line number Diff line change @@ -100,4 +100,16 @@ void query_refspecs_multiple(struct refspec *rs,
100100 struct refspec_item * query ,
101101 struct string_list * results );
102102
103+ /*
104+ * Remove all entries in the input list which match any negative refspec in
105+ * the refspec list.
106+ */
107+ struct ref * apply_negative_refspecs (struct ref * ref_map , struct refspec * rs );
108+
109+ /*
110+ * Applies refspecs to a name and returns the corresponding destination.
111+ * Returns the destination string if a match is found, NULL otherwise.
112+ */
113+ char * apply_refspecs (struct refspec * rs , const char * name );
114+
103115#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)
907907 }
908908}
909909
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 (omit_name_by_refspec (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 (query_refspecs (rs , & query ))
936- return NULL ;
937-
938- return query .dst ;
939- }
940-
941910int remote_find_tracking (struct remote * remote , struct refspec_item * refspec )
942911{
943912 return query_refspecs (& remote -> fetch , refspec );
Original file line number Diff line number Diff line change @@ -261,14 +261,6 @@ int resolve_remote_symref(struct ref *ref, struct ref *list);
261261 */
262262struct ref * ref_remove_duplicates (struct ref * ref_map );
263263
264- /*
265- * Remove all entries in the input list which match any negative refspec in
266- * the refspec list.
267- */
268- struct ref * apply_negative_refspecs (struct ref * ref_map , struct refspec * rs );
269-
270- char * apply_refspecs (struct refspec * rs , const char * name );
271-
272264int check_push_refs (struct ref * src , struct refspec * rs );
273265int match_push_refs (struct ref * src , struct ref * * dst ,
274266 struct refspec * rs , int flags );
You can’t perform that action at this time.
0 commit comments