@@ -130,56 +130,80 @@ GIT_EXTERN(int) git_libgit2_version(int *major, int *minor, int *rev);
130
130
GIT_EXTERN (const char * ) git_libgit2_prerelease (void );
131
131
132
132
/**
133
- * Combinations of these values describe the features with which libgit2
134
- * was compiled
133
+ * Configurable features of libgit2; either optional settings (like
134
+ * threading), or features that can be enabled by one of a number of
135
+ * different backend "providers" (like HTTPS, which can be provided by
136
+ * OpenSSL, mbedTLS, or system libraries).
135
137
*/
136
138
typedef enum {
137
- /**
138
- * If set, libgit2 was built thread-aware and can be safely used from multiple
139
- * threads.
140
- */
141
- GIT_FEATURE_THREADS = (1 << 0 ),
142
- /**
143
- * If set, libgit2 was built with and linked against a TLS implementation.
144
- * Custom TLS streams may still be added by the user to support HTTPS
145
- * regardless of this.
146
- */
147
- GIT_FEATURE_HTTPS = (1 << 1 ),
148
- /**
149
- * If set, libgit2 was built with and linked against libssh2. A custom
150
- * transport may still be added by the user to support libssh2 regardless of
151
- * this.
152
- */
153
- GIT_FEATURE_SSH = (1 << 2 ),
154
- /**
155
- * If set, libgit2 was built with support for sub-second resolution in file
156
- * modification times.
157
- */
158
- GIT_FEATURE_NSEC = (1 << 3 )
139
+ /**
140
+ * libgit2 is thread-aware and can be used from multiple threads
141
+ * (as described in the documentation).
142
+ */
143
+ GIT_FEATURE_THREADS = (1 << 0 ),
144
+
145
+ /** HTTPS remotes */
146
+ GIT_FEATURE_HTTPS = (1 << 1 ),
147
+
148
+ /** SSH remotes */
149
+ GIT_FEATURE_SSH = (1 << 2 ),
150
+
151
+ /** Sub-second resolution in index timestamps */
152
+ GIT_FEATURE_NSEC = (1 << 3 ),
153
+
154
+ /** HTTP parsing; always available */
155
+ GIT_FEATURE_HTTP_PARSER = (1 << 4 ),
156
+
157
+ /** Regular expression support; always available */
158
+ GIT_FEATURE_REGEX = (1 << 5 ),
159
+
160
+ /** Internationalization support for filename translation */
161
+ GIT_FEATURE_I18N = (1 << 6 ),
162
+
163
+ /** NTLM support over HTTPS */
164
+ GIT_FEATURE_AUTH_NTLM = (1 << 7 ),
165
+
166
+ /** Kerberos (SPNEGO) authentication support over HTTPS */
167
+ GIT_FEATURE_AUTH_NEGOTIATE = (1 << 8 ),
168
+
169
+ /** zlib support; always available */
170
+ GIT_FEATURE_COMPRESSION = (1 << 9 ),
171
+
172
+ /** SHA1 object support; always available */
173
+ GIT_FEATURE_SHA1 = (1 << 10 ),
174
+
175
+ /** SHA256 object support */
176
+ GIT_FEATURE_SHA256 = (1 << 11 )
159
177
} git_feature_t ;
160
178
161
179
/**
162
180
* Query compile time options for libgit2.
163
181
*
164
182
* @return A combination of GIT_FEATURE_* values.
183
+ */
184
+ GIT_EXTERN (int ) git_libgit2_features (void );
185
+
186
+ /**
187
+ * Query the backend details for the compile-time feature in libgit2.
165
188
*
166
- * - GIT_FEATURE_THREADS
167
- * Libgit2 was compiled with thread support. Note that thread support is
168
- * still to be seen as a 'work in progress' - basic object lookups are
169
- * believed to be threadsafe, but other operations may not be.
189
+ * This will return the "backend" for the feature, which is useful for
190
+ * things like HTTPS or SSH support, that can have multiple backends
191
+ * that could be compiled in.
170
192
*
171
- * - GIT_FEATURE_HTTPS
172
- * Libgit2 supports the https:// protocol. This requires the openssl
173
- * library to be found when compiling libgit2.
193
+ * For example, when libgit2 is compiled with dynamic OpenSSL support,
194
+ * the feature backend will be `openssl-dynamic`. The feature backend
195
+ * names reflect the compilation options specified to the build system
196
+ * (though in all lower case). The backend _may_ be "builtin" for
197
+ * features that are provided by libgit2 itself.
174
198
*
175
- * - GIT_FEATURE_SSH
176
- * Libgit2 supports the SSH protocol for network operations. This requires
177
- * the libssh2 library to be found when compiling libgit2
199
+ * If the feature is not supported by the library, this API returns
200
+ * `NULL`.
178
201
*
179
- * - GIT_FEATURE_NSEC
180
- * Libgit2 supports the sub-second resolution in file modification times.
202
+ * @param feature the feature to query details for
203
+ * @return the provider details, or NULL if the feature is not supported
181
204
*/
182
- GIT_EXTERN (int ) git_libgit2_features (void );
205
+ GIT_EXTERN (const char * ) git_libgit2_feature_backend (
206
+ git_feature_t feature );
183
207
184
208
/**
185
209
* Global library options
0 commit comments