diff options
Diffstat (limited to 'tests/hawd')
-rw-r--r-- | tests/hawd/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tests/hawd/state.cpp | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/tests/hawd/CMakeLists.txt b/tests/hawd/CMakeLists.txt index b3de83e..6ae5f13 100644 --- a/tests/hawd/CMakeLists.txt +++ b/tests/hawd/CMakeLists.txt | |||
@@ -1,6 +1,7 @@ | |||
1 | project(hawd) | 1 | project(hawd) |
2 | 2 | ||
3 | find_package(Libgit2) | 3 | #We require git_buf_free function |
4 | find_package(Libgit2 0.20.0) | ||
4 | 5 | ||
5 | if (LIBGIT2_FOUND) | 6 | if (LIBGIT2_FOUND) |
6 | add_definitions(-DHAVE_LIBGIT2) | 7 | add_definitions(-DHAVE_LIBGIT2) |
diff --git a/tests/hawd/state.cpp b/tests/hawd/state.cpp index dbfe019..dfeef41 100644 --- a/tests/hawd/state.cpp +++ b/tests/hawd/state.cpp | |||
@@ -116,6 +116,7 @@ const char *State::commitHash() const | |||
116 | void State::findGitHash() | 116 | void State::findGitHash() |
117 | { | 117 | { |
118 | #ifdef HAVE_LIBGIT2 | 118 | #ifdef HAVE_LIBGIT2 |
119 | git_libgit2_init(); | ||
119 | git_buf root = {0}; | 120 | git_buf root = {0}; |
120 | int error = git_repository_discover(&root, projectPath().toStdString().data(), 0, NULL); | 121 | int error = git_repository_discover(&root, projectPath().toStdString().data(), 0, NULL); |
121 | if (!error) { | 122 | if (!error) { |
@@ -133,6 +134,7 @@ void State::findGitHash() | |||
133 | git_repository_free(repo); | 134 | git_repository_free(repo); |
134 | } | 135 | } |
135 | git_buf_free(&root); | 136 | git_buf_free(&root); |
137 | git_libgit2_shutdown(); | ||
136 | #endif | 138 | #endif |
137 | } | 139 | } |
138 | 140 | ||