Commit 09b640fc authored by Dominik Haumann's avatar Dominik Haumann

properly handle ligbit2 resource

Thanks to Andrew Wilcox for the patch!

BUG: 352627
FIXED-IN: 15.12
CHANGELOG: fixed bug #352627: properly use libgit2 resource
parent 11f9c8e0
......@@ -276,12 +276,15 @@ QStringList KateProjectWorker::filesFromGit(const QDir &dir, bool recursive)
return 0;
};
git_libgit2_init();
if (git_repository_open_ext(&repo, dir.path().toUtf8().data(), 0, NULL)) {
return QStringList();
}
if ((working_dir = git_repository_workdir(repo)) == nullptr) {
git_repository_free(repo);
git_libgit2_shutdown();
return files;
}
......@@ -290,6 +293,7 @@ QStringList KateProjectWorker::filesFromGit(const QDir &dir, bool recursive)
if (git_revparse_single(&root_tree, repo, "HEAD^{tree}")) {
git_repository_free(repo);
git_libgit2_shutdown();
return files;
}
......@@ -299,6 +303,7 @@ QStringList KateProjectWorker::filesFromGit(const QDir &dir, bool recursive)
if (git_object_lookup_bypath(&tree, root_tree, relpath.toUtf8().data(), GIT_OBJ_TREE)) {
git_object_free(root_tree);
git_repository_free(repo);
git_libgit2_shutdown();
return files;
}
}
......@@ -311,6 +316,7 @@ QStringList KateProjectWorker::filesFromGit(const QDir &dir, bool recursive)
git_object_free(root_tree);
git_repository_free(repo);
git_libgit2_shutdown();
return files;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment