summaryrefslogtreecommitdiff
path: root/features.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2016-11-01 00:16:27 +0100
committerGitHub <[email protected]>2016-11-01 00:16:27 +0100
commit9af9dd3ad71055e60ff7af6ffd5da42960915996 (patch)
treee329c89e802e83dcbfa615e366350afe4412ab01 /features.go
parent098cd42070db3393651752ddbbf0726db5778c7c (diff)
parenta37f7f30ff94e32b20866cf2fa28496c60826278 (diff)
Merge pull request #354 from libgit2/cmn/panic-threading
Add Feature query support & panic if libgit2 is not thread-aware
Diffstat (limited to 'features.go')
-rw-r--r--features.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/features.go b/features.go
new file mode 100644
index 0000000..f6474a0
--- /dev/null
+++ b/features.go
@@ -0,0 +1,30 @@
+package git
+
+/*
+#include <git2.h>
+*/
+import "C"
+
+type Feature int
+
+const (
+ // libgit2 was built with threading support
+ FeatureThreads Feature = C.GIT_FEATURE_THREADS
+
+ // libgit2 was built with HTTPS support built-in
+ FeatureHttps Feature = C.GIT_FEATURE_HTTPS
+
+ // libgit2 was build with SSH support built-in
+ FeatureSsh Feature = C.GIT_FEATURE_SSH
+
+ // libgit2 was built with nanosecond support for files
+ FeatureNSec Feature = C.GIT_FEATURE_NSEC
+)
+
+// Features returns a bit-flag of Feature values indicating which features the
+// loaded libgit2 library has.
+func Features() Feature {
+ features := C.git_libgit2_features()
+
+ return Feature(features)
+}