From 63f91e1ce856da0a6cfd7ec70f24b087a30ef358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Wed, 22 Jun 2011 16:52:30 +0200 Subject: Add git.git's fnmatch, which is really GNU's and the git__fnmatch wrapper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the strings match, git__fnmatch returns GIT_SUCCESS and GIT_ENOMATCH on failure to match. MSVC fixes: Added a test for _MSC_VER and (in that case) defined HAVE_STRING_H to 1 so it doesn't try to include which doesn't exist in the MSVC world. Moved the function declarations to use the modern inline ones so MSVC doesn't have a fit. Added casts everywhere so MSVC doesn't crap its pants. Signed-off-by: Carlos Martín Nieto --- include/git2/errors.h | 3 +++ include/git2/refspec.h | 10 ++++++++++ 2 files changed, 13 insertions(+) (limited to 'include') diff --git a/include/git2/errors.h b/include/git2/errors.h index 09b1f26bb..334b9edab 100644 --- a/include/git2/errors.h +++ b/include/git2/errors.h @@ -125,6 +125,9 @@ typedef enum { /** Skip and passthrough the given ODB backend */ GIT_EPASSTHROUGH = -30, + + /** The path pattern and string did not match */ + GIT_ENOMATCH = -31, } git_error; /** diff --git a/include/git2/refspec.h b/include/git2/refspec.h index d45364f71..8523d5ab6 100644 --- a/include/git2/refspec.h +++ b/include/git2/refspec.h @@ -19,4 +19,14 @@ const char *git_refspec_src(const git_refspec *refspec); */ const char *git_refspec_dst(const git_refspec *refspec); +/** + * Match a refspec's source descriptor with a reference name + * + * @param refspec the refspec + * @param refname the name of the reference to check + * @return GIT_SUCCESS on successful match; GIT_ENOMACH on match + * failure or an error code on other failure + */ +int git_refspec_src_match(const git_refspec *refspec, const char *refname); + #endif -- cgit v1.2.1