Add method to get the compiled version of the lib

This commit is contained in:
Vicent Marti 2011-06-16 02:21:33 +02:00
parent ef9a6f4cbc
commit 536955f9d7
2 changed files with 18 additions and 0 deletions

View File

@ -113,6 +113,16 @@ typedef struct {
GIT_EXTERN(void) git_strarray_free(git_strarray *array);
/**
* Return the version of the libgit2 library
* being currently used.
*
* @param major Store the major version number
* @param minor Store the minor version number
* @param rev Store the revision (patch) number
*/
GIT_EXTERN(void) git_libgit2_version(int *major, int *minor, int *rev);
/** @} */
GIT_END_DECL
#endif

View File

@ -1,9 +1,17 @@
#define GIT__NO_HIDE_MALLOC
#include <git2.h>
#include "common.h"
#include <stdarg.h>
#include <stdio.h>
#include <ctype.h>
void git_libgit2_version(int *major, int *minor, int *rev)
{
*major = LIBGIT2_VER_MAJOR;
*minor = LIBGIT2_VER_MINOR;
*rev = LIBGIT2_VER_REVISION;
}
void git_strarray_free(git_strarray *array)
{
size_t i;