From d0b00e3124a35d7b6adc73c0a36dfa3e50c9768f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Wed, 14 Jan 2015 20:47:47 +0100 Subject: [PATCH] Add support for libgit2 feature detection This lets us ask the library whether it supports threading, https and ssh. --- docs/features.rst | 8 ++++++++ docs/index.rst | 1 + pygit2/__init__.py | 5 +++++ pygit2/decl.h | 6 ++++++ 4 files changed, 20 insertions(+) create mode 100644 docs/features.rst diff --git a/docs/features.rst b/docs/features.rst new file mode 100644 index 000000000..2b26fde14 --- /dev/null +++ b/docs/features.rst @@ -0,0 +1,8 @@ +********************************************************************** +Feature detection +********************************************************************** + +.. py:data:: pygit2.features + + This variable contains a combination of `GIT_FEATURE_*` flags, + indicating which features a particular build of libgit2 supports. diff --git a/docs/index.rst b/docs/index.rst index fbdfd408e..156f0acfc 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -47,6 +47,7 @@ Usage guide: remotes blame settings + features Indices and tables diff --git a/pygit2/__init__.py b/pygit2/__init__.py index 995fe6cd0..3ddfdacf3 100644 --- a/pygit2/__init__.py +++ b/pygit2/__init__.py @@ -221,3 +221,8 @@ def clone_into(repo, remote, branch=None): check_error(err) settings = Settings() + +features = C.git_libgit2_features() +GIT_FEATURE_THREADS = C.GIT_FEATURE_THREADS +GIT_FEATURE_HTTPS = C.GIT_FEATURE_HTTPS +GIT_FEATURE_SSH = C.GIT_FEATURE_SSH diff --git a/pygit2/decl.h b/pygit2/decl.h index 5c4d9a68d..55cf0cc87 100644 --- a/pygit2/decl.h +++ b/pygit2/decl.h @@ -74,6 +74,12 @@ typedef struct git_signature { git_time when; } git_signature; +#define GIT_FEATURE_THREADS ... +#define GIT_FEATURE_HTTPS ... +#define GIT_FEATURE_SSH ... + +int git_libgit2_features(void); + const git_error * giterr_last(void); void git_strarray_free(git_strarray *array);