diff options
| author | Meet Soni <meetsoni3017@gmail.com> | 2025-02-04 09:35:57 +0530 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-02-04 09:51:41 -0800 |
| commit | 7b24a170d2c36c83c3669d194af46a09ccdeec43 (patch) | |
| tree | e2bafbb58fa1d1f8890cafe781df34ee7a9acbfc /refspec.h | |
| parent | remote: rename query_refspecs functions (diff) | |
| download | git-7b24a170d2c36c83c3669d194af46a09ccdeec43.tar.gz git-7b24a170d2c36c83c3669d194af46a09ccdeec43.zip | |
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>
Diffstat (limited to 'refspec.h')
| -rw-r--r-- | refspec.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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 */ |
