Skip to content

Commit adb1770

Browse files
committed
Add Features() to retrieve the compile-time features of libgit2
1 parent 098cd42 commit adb1770

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

features.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package git
2+
3+
/*
4+
#include <git2.h>
5+
*/
6+
import "C"
7+
8+
type Feature int
9+
10+
const (
11+
// libgit2 was built with threading support
12+
FeatureThreads Feature = C.GIT_FEATURE_THREADS
13+
14+
// libgit2 was built with HTTPS support built-in
15+
FeatureHttps Feature = C.GIT_FEATURE_HTTPS
16+
17+
// libgit2 was build with SSH support built-in
18+
FeatureSsh Feature = C.GIT_FEATURE_SSH
19+
20+
// libgit2 was built with nanosecond support for files
21+
FeatureNSec Feature = C.GIT_FEATURE_NSEC
22+
)
23+
24+
// Features returns a bit-flag of Feature values indicating which features the
25+
// loaded libgit2 library has.
26+
func Features() Feature {
27+
features := C.git_libgit2_features()
28+
29+
return Feature(features)
30+
}

0 commit comments

Comments
 (0)