Libgit2 - C: How Can I Tell Which Version Is Being Used
I am writing an application that uses libgit2:
At some point I am using a value from an enum defined in types.h:
But I just noticed that in previous versions it is called GIT_OBJ_TREE:
Tnen the queston is, how can I know what version of libgit2 is being used? I though that perhaps there is a defined value that I could use that that I cold then use something like:
#ifdef GIT2_0_28 // use GIT_OBJECT_TREE #else // use GIT_OBJ_TREE #endif
But I don't see something like that. What other trick can I use?
Ended up using stuff from https://github.com/libgit2/libgit2/blob/v0.28.0/include/git2/version.h.
In my file:
#if LIBGIT2_SOVERSION < 28 // old implementation #define GIT2_OBJECT_TREE GIT_OBJ_TREE #else // new implementation #define GIT2_OBJECT_TREE GIT_OBJECT_TREE #endif
Then in my code I use
Will mark this as the answer until a better (simpler) one comes up.
- → OctoberCMS Backend Loging Hash Error
- → "failed to open stream" error when executing "migrate:make"
- → OctoberCMS - How to make collapsible list default to active only on non-mobile
- → Create plugin that makes objects from model in back-end
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → How to install console for plugin development in October CMS
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → How to update data attribute on Ajax complete
- → October CMS - Conditionally Load a Different Page