Commit f34b9a59 by Vicent Marti

Merge pull request #2150 from libgit2/vmg/features

caps: Rename to features to avoid confusion
parents 494be429 ebb3c506
...@@ -94,29 +94,34 @@ GIT_BEGIN_DECL ...@@ -94,29 +94,34 @@ GIT_BEGIN_DECL
GIT_EXTERN(void) git_libgit2_version(int *major, int *minor, int *rev); GIT_EXTERN(void) git_libgit2_version(int *major, int *minor, int *rev);
/** /**
* Combinations of these values describe the capabilities of libgit2. * Combinations of these values describe the features with which libgit2
* was compiled
*/ */
typedef enum { typedef enum {
GIT_CAP_THREADS = ( 1 << 0 ), GIT_FEATURE_THREADS = (1 << 0),
GIT_CAP_HTTPS = ( 1 << 1 ), GIT_FEATURE_HTTPS = (1 << 1),
GIT_CAP_SSH = ( 1 << 2 ), GIT_FEATURE_SSH = (1 << 2),
} git_cap_t; } git_feature_t;
/** /**
* Query compile time options for libgit2. * Query compile time options for libgit2.
* *
* @return A combination of GIT_CAP_* values. * @return A combination of GIT_FEATURE_* values.
* *
* - GIT_CAP_THREADS * - GIT_FEATURE_THREADS
* Libgit2 was compiled with thread support. Note that thread support is * Libgit2 was compiled with thread support. Note that thread support is
* still to be seen as a 'work in progress' - basic object lookups are * still to be seen as a 'work in progress' - basic object lookups are
* believed to be threadsafe, but other operations may not be. * believed to be threadsafe, but other operations may not be.
* *
* - GIT_CAP_HTTPS * - GIT_FEATURE_HTTPS
* Libgit2 supports the https:// protocol. This requires the openssl * Libgit2 supports the https:// protocol. This requires the openssl
* library to be found when compiling libgit2. * library to be found when compiling libgit2.
*
* - GIT_FEATURE_SSH
* Libgit2 supports the SSH protocol for network operations. This requires
* the openssh to be found when compiling libgit2
*/ */
GIT_EXTERN(int) git_libgit2_capabilities(void); GIT_EXTERN(int) git_libgit2_features(void);
typedef enum { typedef enum {
......
...@@ -17,17 +17,17 @@ void git_libgit2_version(int *major, int *minor, int *rev) ...@@ -17,17 +17,17 @@ void git_libgit2_version(int *major, int *minor, int *rev)
*rev = LIBGIT2_VER_REVISION; *rev = LIBGIT2_VER_REVISION;
} }
int git_libgit2_capabilities() int git_libgit2_features()
{ {
return 0 return 0
#ifdef GIT_THREADS #ifdef GIT_THREADS
| GIT_CAP_THREADS | GIT_FEATURE_THREADS
#endif #endif
#if defined(GIT_SSL) || defined(GIT_WINHTTP) #if defined(GIT_SSL) || defined(GIT_WINHTTP)
| GIT_CAP_HTTPS | GIT_FEATURE_HTTPS
#endif #endif
#if defined(GIT_SSH) #if defined(GIT_SSH)
| GIT_CAP_SSH | GIT_FEATURE_SSH
#endif #endif
; ;
} }
......
#include "clar_libgit2.h" #include "clar_libgit2.h"
void test_core_caps__0(void) void test_core_features__0(void)
{ {
int major, minor, rev, caps; int major, minor, rev, caps;
...@@ -9,23 +9,23 @@ void test_core_caps__0(void) ...@@ -9,23 +9,23 @@ void test_core_caps__0(void)
cl_assert_equal_i(LIBGIT2_VER_MINOR, minor); cl_assert_equal_i(LIBGIT2_VER_MINOR, minor);
cl_assert_equal_i(LIBGIT2_VER_REVISION, rev); cl_assert_equal_i(LIBGIT2_VER_REVISION, rev);
caps = git_libgit2_capabilities(); caps = git_libgit2_features();
#ifdef GIT_THREADS #ifdef GIT_THREADS
cl_assert((caps & GIT_CAP_THREADS) != 0); cl_assert((caps & GIT_FEATURE_THREADS) != 0);
#else #else
cl_assert((caps & GIT_CAP_THREADS) == 0); cl_assert((caps & GIT_FEATURE_THREADS) == 0);
#endif #endif
#if defined(GIT_SSL) || defined(GIT_WINHTTP) #if defined(GIT_SSL) || defined(GIT_WINHTTP)
cl_assert((caps & GIT_CAP_HTTPS) != 0); cl_assert((caps & GIT_FEATURE_HTTPS) != 0);
#else #else
cl_assert((caps & GIT_CAP_HTTPS) == 0); cl_assert((caps & GIT_FEATURE_HTTPS) == 0);
#endif #endif
#if defined(GIT_SSH) #if defined(GIT_SSH)
cl_assert((caps & GIT_CAP_SSH) != 0); cl_assert((caps & GIT_FEATURE_SSH) != 0);
#else #else
cl_assert((caps & GIT_CAP_SSH) == 0); cl_assert((caps & GIT_FEATURE_SSH) == 0);
#endif #endif
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment