refactor: remove unnecessary git_libgit2_init()

This commit is contained in:
Aleksey Kulikov 2021-09-01 16:59:07 +03:00
parent ce9384cac9
commit 6bd04bb09d
5 changed files with 1 additions and 8 deletions

View file

@ -23,7 +23,6 @@ class Commit {
/// ///
/// Should be freed with `free()` to release allocated memory. /// Should be freed with `free()` to release allocated memory.
Commit.lookup(Repository repo, Oid oid) { Commit.lookup(Repository repo, Oid oid) {
libgit2.git_libgit2_init();
_commitPointer = bindings.lookup(repo.pointer, oid.pointer); _commitPointer = bindings.lookup(repo.pointer, oid.pointer);
} }

View file

@ -17,7 +17,6 @@ class Oid {
/// ///
/// Throws a [LibGit2Error] if error occured. /// Throws a [LibGit2Error] if error occured.
Oid.fromSHA(Repository repository, String sha) { Oid.fromSHA(Repository repository, String sha) {
libgit2.git_libgit2_init();
if (sha.length == 40) { if (sha.length == 40) {
_oidPointer = bindings.fromSHA(sha); _oidPointer = bindings.fromSHA(sha);
} else { } else {

View file

@ -38,9 +38,7 @@ class References {
class Reference { class Reference {
/// Initializes a new instance of the [Reference] class. /// Initializes a new instance of the [Reference] class.
/// Should be freed with `free()` to release allocated memory. /// Should be freed with `free()` to release allocated memory.
Reference(this._repoPointer, this._refPointer) { Reference(this._repoPointer, this._refPointer);
libgit2.git_libgit2_init();
}
/// Initializes a new instance of the [Reference] class by creating a new direct reference. /// Initializes a new instance of the [Reference] class by creating a new direct reference.
/// ///

View file

@ -5,13 +5,11 @@ import 'commit.dart';
import 'oid.dart'; import 'oid.dart';
import 'repository.dart'; import 'repository.dart';
import 'enums.dart'; import 'enums.dart';
import 'util.dart';
class RevWalk { class RevWalk {
/// Initializes a new instance of the [RevWalk] class. /// Initializes a new instance of the [RevWalk] class.
/// Should be freed with `free()` to release allocated memory. /// Should be freed with `free()` to release allocated memory.
RevWalk(Repository repo) { RevWalk(Repository repo) {
libgit2.git_libgit2_init();
_revWalkPointer = bindings.create(repo.pointer); _revWalkPointer = bindings.create(repo.pointer);
} }

View file

@ -18,7 +18,6 @@ class Tree {
/// ///
/// Should be freed with `free()` to release allocated memory. /// Should be freed with `free()` to release allocated memory.
Tree.lookup(Repository repo, Oid id) { Tree.lookup(Repository repo, Oid id) {
libgit2.git_libgit2_init();
_treePointer = bindings.lookup(repo.pointer, id.pointer); _treePointer = bindings.lookup(repo.pointer, id.pointer);
} }