From c9f5298b0e7a1c21da35618be33ae651cbcdbcef Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Mon, 3 Mar 2014 12:09:17 +0100 Subject: [PATCH 1/3] caps: Rename to features to avoid confusion --- include/git2/common.h | 21 +++++++++++++-------- src/settings.c | 8 ++++---- tests/core/{caps.c => features.c} | 16 ++++++++-------- 3 files changed, 25 insertions(+), 20 deletions(-) rename tests/core/{caps.c => features.c} (54%) diff --git a/include/git2/common.h b/include/git2/common.h index 492715447..49ffd01d6 100644 --- a/include/git2/common.h +++ b/include/git2/common.h @@ -94,29 +94,34 @@ GIT_BEGIN_DECL 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 { - GIT_CAP_THREADS = ( 1 << 0 ), - GIT_CAP_HTTPS = ( 1 << 1 ), - GIT_CAP_SSH = ( 1 << 2 ), + GIT_HAS_THREADS = (1 << 0), + GIT_HAS_HTTPS = (1 << 1), + GIT_HAS_SSH = (1 << 2), } git_cap_t; /** * Query compile time options for libgit2. * - * @return A combination of GIT_CAP_* values. + * @return A combination of GIT_HAS_* values. * - * - GIT_CAP_THREADS + * - GIT_HAS_THREADS * Libgit2 was compiled with thread support. Note that thread support is * still to be seen as a 'work in progress' - basic object lookups are * believed to be threadsafe, but other operations may not be. * - * - GIT_CAP_HTTPS + * - GIT_HAS_HTTPS * Libgit2 supports the https:// protocol. This requires the openssl * library to be found when compiling libgit2. + * + * - GIT_HAS_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 { diff --git a/src/settings.c b/src/settings.c index 3856735f7..644e71cca 100644 --- a/src/settings.c +++ b/src/settings.c @@ -17,17 +17,17 @@ void git_libgit2_version(int *major, int *minor, int *rev) *rev = LIBGIT2_VER_REVISION; } -int git_libgit2_capabilities() +int git_libgit2_features() { return 0 #ifdef GIT_THREADS - | GIT_CAP_THREADS + | GIT_HAS_THREADS #endif #if defined(GIT_SSL) || defined(GIT_WINHTTP) - | GIT_CAP_HTTPS + | GIT_HAS_HTTPS #endif #if defined(GIT_SSH) - | GIT_CAP_SSH + | GIT_HAS_SSH #endif ; } diff --git a/tests/core/caps.c b/tests/core/features.c similarity index 54% rename from tests/core/caps.c rename to tests/core/features.c index 68a518ed7..b8c9003ba 100644 --- a/tests/core/caps.c +++ b/tests/core/features.c @@ -1,6 +1,6 @@ #include "clar_libgit2.h" -void test_core_caps__0(void) +void test_core_features__0(void) { int major, minor, rev, caps; @@ -9,23 +9,23 @@ void test_core_caps__0(void) cl_assert_equal_i(LIBGIT2_VER_MINOR, minor); cl_assert_equal_i(LIBGIT2_VER_REVISION, rev); - caps = git_libgit2_capabilities(); + caps = git_libgit2_features(); #ifdef GIT_THREADS - cl_assert((caps & GIT_CAP_THREADS) != 0); + cl_assert((caps & GIT_HAS_THREADS) != 0); #else - cl_assert((caps & GIT_CAP_THREADS) == 0); + cl_assert((caps & GIT_HAS_THREADS) == 0); #endif #if defined(GIT_SSL) || defined(GIT_WINHTTP) - cl_assert((caps & GIT_CAP_HTTPS) != 0); + cl_assert((caps & GIT_HAS_HTTPS) != 0); #else - cl_assert((caps & GIT_CAP_HTTPS) == 0); + cl_assert((caps & GIT_HAS_HTTPS) == 0); #endif #if defined(GIT_SSH) - cl_assert((caps & GIT_CAP_SSH) != 0); + cl_assert((caps & GIT_HAS_SSH) != 0); #else - cl_assert((caps & GIT_CAP_SSH) == 0); + cl_assert((caps & GIT_HAS_SSH) == 0); #endif } From 2491c416ed84fb575506b0b58fb234ab2daa24fb Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Mon, 3 Mar 2014 12:13:17 +0100 Subject: [PATCH 2/3] caps: Rename the enum name too! --- include/git2/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/git2/common.h b/include/git2/common.h index 49ffd01d6..7effc8dba 100644 --- a/include/git2/common.h +++ b/include/git2/common.h @@ -101,7 +101,7 @@ typedef enum { GIT_HAS_THREADS = (1 << 0), GIT_HAS_HTTPS = (1 << 1), GIT_HAS_SSH = (1 << 2), -} git_cap_t; +} git_feature_t; /** * Query compile time options for libgit2. From ebb3c506fd880a383ea66679865e16e24253cb3a Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Mon, 3 Mar 2014 12:40:25 +0100 Subject: [PATCH 3/3] features: Rename `_HAS_` to `_FEATURE_` --- include/git2/common.h | 14 +++++++------- src/settings.c | 6 +++--- tests/core/features.c | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/git2/common.h b/include/git2/common.h index 7effc8dba..4b3e02e41 100644 --- a/include/git2/common.h +++ b/include/git2/common.h @@ -98,26 +98,26 @@ GIT_EXTERN(void) git_libgit2_version(int *major, int *minor, int *rev); * was compiled */ typedef enum { - GIT_HAS_THREADS = (1 << 0), - GIT_HAS_HTTPS = (1 << 1), - GIT_HAS_SSH = (1 << 2), + GIT_FEATURE_THREADS = (1 << 0), + GIT_FEATURE_HTTPS = (1 << 1), + GIT_FEATURE_SSH = (1 << 2), } git_feature_t; /** * Query compile time options for libgit2. * - * @return A combination of GIT_HAS_* values. + * @return A combination of GIT_FEATURE_* values. * - * - GIT_HAS_THREADS + * - GIT_FEATURE_THREADS * Libgit2 was compiled with thread support. Note that thread support is * still to be seen as a 'work in progress' - basic object lookups are * believed to be threadsafe, but other operations may not be. * - * - GIT_HAS_HTTPS + * - GIT_FEATURE_HTTPS * Libgit2 supports the https:// protocol. This requires the openssl * library to be found when compiling libgit2. * - * - GIT_HAS_SSH + * - GIT_FEATURE_SSH * Libgit2 supports the SSH protocol for network operations. This requires * the openssh to be found when compiling libgit2 */ diff --git a/src/settings.c b/src/settings.c index 644e71cca..9308f94ec 100644 --- a/src/settings.c +++ b/src/settings.c @@ -21,13 +21,13 @@ int git_libgit2_features() { return 0 #ifdef GIT_THREADS - | GIT_HAS_THREADS + | GIT_FEATURE_THREADS #endif #if defined(GIT_SSL) || defined(GIT_WINHTTP) - | GIT_HAS_HTTPS + | GIT_FEATURE_HTTPS #endif #if defined(GIT_SSH) - | GIT_HAS_SSH + | GIT_FEATURE_SSH #endif ; } diff --git a/tests/core/features.c b/tests/core/features.c index b8c9003ba..3ce02f4d6 100644 --- a/tests/core/features.c +++ b/tests/core/features.c @@ -12,20 +12,20 @@ void test_core_features__0(void) caps = git_libgit2_features(); #ifdef GIT_THREADS - cl_assert((caps & GIT_HAS_THREADS) != 0); + cl_assert((caps & GIT_FEATURE_THREADS) != 0); #else - cl_assert((caps & GIT_HAS_THREADS) == 0); + cl_assert((caps & GIT_FEATURE_THREADS) == 0); #endif #if defined(GIT_SSL) || defined(GIT_WINHTTP) - cl_assert((caps & GIT_HAS_HTTPS) != 0); + cl_assert((caps & GIT_FEATURE_HTTPS) != 0); #else - cl_assert((caps & GIT_HAS_HTTPS) == 0); + cl_assert((caps & GIT_FEATURE_HTTPS) == 0); #endif #if defined(GIT_SSH) - cl_assert((caps & GIT_HAS_SSH) != 0); + cl_assert((caps & GIT_FEATURE_SSH) != 0); #else - cl_assert((caps & GIT_HAS_SSH) == 0); + cl_assert((caps & GIT_FEATURE_SSH) == 0); #endif }