Merge pull request #2150 from libgit2/vmg/features caps: Rename to features to avoid confusion
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
diff --git a/include/git2/common.h b/include/git2/common.h
index 4927154..4b3e02e 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_cap_t;
+ 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_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
* 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_FEATURE_HTTPS
* Libgit2 supports the https:// protocol. This requires the openssl
* 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 {
diff --git a/src/settings.c b/src/settings.c
index 3856735..9308f94 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_FEATURE_THREADS
#endif
#if defined(GIT_SSL) || defined(GIT_WINHTTP)
- | GIT_CAP_HTTPS
+ | GIT_FEATURE_HTTPS
#endif
#if defined(GIT_SSH)
- | GIT_CAP_SSH
+ | GIT_FEATURE_SSH
#endif
;
}
diff --git a/tests/core/caps.c b/tests/core/caps.c
deleted file mode 100644
index 68a518e..0000000
--- a/tests/core/caps.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "clar_libgit2.h"
-
-void test_core_caps__0(void)
-{
- int major, minor, rev, caps;
-
- git_libgit2_version(&major, &minor, &rev);
- cl_assert_equal_i(LIBGIT2_VER_MAJOR, major);
- cl_assert_equal_i(LIBGIT2_VER_MINOR, minor);
- cl_assert_equal_i(LIBGIT2_VER_REVISION, rev);
-
- caps = git_libgit2_capabilities();
-
-#ifdef GIT_THREADS
- cl_assert((caps & GIT_CAP_THREADS) != 0);
-#else
- cl_assert((caps & GIT_CAP_THREADS) == 0);
-#endif
-
-#if defined(GIT_SSL) || defined(GIT_WINHTTP)
- cl_assert((caps & GIT_CAP_HTTPS) != 0);
-#else
- cl_assert((caps & GIT_CAP_HTTPS) == 0);
-#endif
-
-#if defined(GIT_SSH)
- cl_assert((caps & GIT_CAP_SSH) != 0);
-#else
- cl_assert((caps & GIT_CAP_SSH) == 0);
-#endif
-}
diff --git a/tests/core/features.c b/tests/core/features.c
new file mode 100644
index 0000000..3ce02f4
--- /dev/null
+++ b/tests/core/features.c
@@ -0,0 +1,31 @@
+#include "clar_libgit2.h"
+
+void test_core_features__0(void)
+{
+ int major, minor, rev, caps;
+
+ git_libgit2_version(&major, &minor, &rev);
+ cl_assert_equal_i(LIBGIT2_VER_MAJOR, major);
+ cl_assert_equal_i(LIBGIT2_VER_MINOR, minor);
+ cl_assert_equal_i(LIBGIT2_VER_REVISION, rev);
+
+ caps = git_libgit2_features();
+
+#ifdef GIT_THREADS
+ cl_assert((caps & GIT_FEATURE_THREADS) != 0);
+#else
+ cl_assert((caps & GIT_FEATURE_THREADS) == 0);
+#endif
+
+#if defined(GIT_SSL) || defined(GIT_WINHTTP)
+ cl_assert((caps & GIT_FEATURE_HTTPS) != 0);
+#else
+ cl_assert((caps & GIT_FEATURE_HTTPS) == 0);
+#endif
+
+#if defined(GIT_SSH)
+ cl_assert((caps & GIT_FEATURE_SSH) != 0);
+#else
+ cl_assert((caps & GIT_FEATURE_SSH) == 0);
+#endif
+}