1 #include <string.h>
2 #include <stdio.h>
3
4 #include "git2.h"
5
6 #include "egit.h"
7 #include "interface.h"
8 #include "egit-libgit2.h"
9
10
11 EGIT_DOC(libgit2_feature_p, "FEATURE",
12 "Check if libgit2 was compiled with FEATURE.\n"
13 "FEATURE may be any of the symbols `threads', `https' or `ssh'.");
egit_libgit2_feature_p(emacs_env * env,emacs_value feature)14 emacs_value egit_libgit2_feature_p(emacs_env *env, emacs_value feature)
15 {
16 git_feature_t features = git_libgit2_features();
17 emacs_value retval;
18 em_checkflag_feature(&retval, env, feature, features, true);
19 return retval;
20 }
21
22 EGIT_DOC(libgit2_version, "", "Get the version of the underlying libgit2.");
egit_libgit2_version(emacs_env * env)23 emacs_value egit_libgit2_version(emacs_env *env)
24 {
25 int major, minor, rev;
26 git_libgit2_version(&major, &minor, &rev);
27
28 int nchars = snprintf(NULL, 0, "%d.%d.%d", major, minor, rev);
29 char buf[nchars];
30 snprintf(buf, 100, "%d.%d.%d", major, minor, rev);
31 return EM_STRING(buf);
32 }
33