refspec: relocate matching related functions
Move the functions `refspec_find_match()`, `refspec_find_all_matches()` and `refspec_find_negative_match()` from `remote.c` to `refspec.c`. These functions focus on matching refspecs, so centralizing them in `refspec.c` improves code organization by keeping refspec-related logic in one place. Signed-off-by: Meet Soni <meetsoni3017@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
be0905fed1
commit
7b24a170d2
16
refspec.h
16
refspec.h
@ -30,6 +30,8 @@ struct refspec_item {
|
||||
char *raw;
|
||||
};
|
||||
|
||||
struct string_list;
|
||||
|
||||
#define REFSPEC_FETCH 1
|
||||
#define REFSPEC_PUSH 0
|
||||
|
||||
@ -80,4 +82,18 @@ int refname_matches_negative_refspec_item(const char *refname, struct refspec *r
|
||||
int match_name_with_pattern(const char *key, const char *name,
|
||||
const char *value, char **result);
|
||||
|
||||
/*
|
||||
* Queries a refspec for a match and updates the query item.
|
||||
* Returns 0 on success, -1 if no match is found or negative refspec matches.
|
||||
*/
|
||||
int refspec_find_match(struct refspec *rs, struct refspec_item *query);
|
||||
|
||||
/*
|
||||
* Queries a refspec for all matches and appends results to the provided string
|
||||
* list.
|
||||
*/
|
||||
void refspec_find_all_matches(struct refspec *rs,
|
||||
struct refspec_item *query,
|
||||
struct string_list *results);
|
||||
|
||||
#endif /* REFSPEC_H */
|
||||
|
Reference in New Issue
Block a user