mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
refactor: remove unnecessary git_libgit2_init()
This commit is contained in:
parent
b5561212e0
commit
b15b56f0ae
5 changed files with 9 additions and 14 deletions
|
@ -6,16 +6,13 @@ import 'git_types.dart';
|
||||||
import 'patch.dart';
|
import 'patch.dart';
|
||||||
import 'oid.dart';
|
import 'oid.dart';
|
||||||
import 'repository.dart';
|
import 'repository.dart';
|
||||||
import 'util.dart';
|
|
||||||
|
|
||||||
class Blob {
|
class Blob {
|
||||||
/// Initializes a new instance of [Blob] class from provided pointer to
|
/// Initializes a new instance of [Blob] class from provided pointer to
|
||||||
/// blob object in memory.
|
/// blob object in memory.
|
||||||
///
|
///
|
||||||
/// Should be freed with `free()` to release allocated memory.
|
/// Should be freed with `free()` to release allocated memory.
|
||||||
Blob(this._blobPointer) {
|
Blob(this._blobPointer);
|
||||||
libgit2.git_libgit2_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Initializes a new instance of [Blob] class from provided
|
/// Initializes a new instance of [Blob] class from provided
|
||||||
/// [Repository] object and [sha] hex string.
|
/// [Repository] object and [sha] hex string.
|
||||||
|
|
|
@ -6,16 +6,13 @@ import 'repository.dart';
|
||||||
import 'oid.dart';
|
import 'oid.dart';
|
||||||
import 'signature.dart';
|
import 'signature.dart';
|
||||||
import 'tree.dart';
|
import 'tree.dart';
|
||||||
import 'util.dart';
|
|
||||||
|
|
||||||
class Commit {
|
class Commit {
|
||||||
/// Initializes a new instance of [Commit] class from provided pointer to
|
/// Initializes a new instance of [Commit] class from provided pointer to
|
||||||
/// commit object in memory.
|
/// commit object in memory.
|
||||||
///
|
///
|
||||||
/// Should be freed with `free()` to release allocated memory.
|
/// Should be freed with `free()` to release allocated memory.
|
||||||
Commit(this._commitPointer) {
|
Commit(this._commitPointer);
|
||||||
libgit2.git_libgit2_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Initializes a new instance of [Commit] class from provided [Repository] object
|
/// Initializes a new instance of [Commit] class from provided [Repository] object
|
||||||
/// and [sha] hex string.
|
/// and [sha] hex string.
|
||||||
|
|
|
@ -12,9 +12,7 @@ class Config with IterableMixin<ConfigEntry> {
|
||||||
/// pointer to config object in memory.
|
/// pointer to config object in memory.
|
||||||
///
|
///
|
||||||
/// Should be freed with `free()` to release allocated memory.
|
/// Should be freed with `free()` to release allocated memory.
|
||||||
Config(this._configPointer) {
|
Config(this._configPointer);
|
||||||
libgit2.git_libgit2_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Initializes a new instance of [Config] class from provided [path].
|
/// Initializes a new instance of [Config] class from provided [path].
|
||||||
///
|
///
|
||||||
|
|
|
@ -13,9 +13,7 @@ class Diff {
|
||||||
/// pointer to diff object in memory.
|
/// pointer to diff object in memory.
|
||||||
///
|
///
|
||||||
/// Should be freed with `free()` to release allocated memory.
|
/// Should be freed with `free()` to release allocated memory.
|
||||||
Diff(this._diffPointer) {
|
Diff(this._diffPointer);
|
||||||
libgit2.git_libgit2_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
Diff.parse(String content) {
|
Diff.parse(String content) {
|
||||||
libgit2.git_libgit2_init();
|
libgit2.git_libgit2_init();
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'bindings/patch.dart' as bindings;
|
||||||
import 'blob.dart';
|
import 'blob.dart';
|
||||||
import 'diff.dart';
|
import 'diff.dart';
|
||||||
import 'git_types.dart';
|
import 'git_types.dart';
|
||||||
|
import 'util.dart';
|
||||||
|
|
||||||
class Patch {
|
class Patch {
|
||||||
/// Initializes a new instance of [Patch] class from provided
|
/// Initializes a new instance of [Patch] class from provided
|
||||||
|
@ -30,6 +31,8 @@ class Patch {
|
||||||
int contextLines = 3,
|
int contextLines = 3,
|
||||||
int interhunkLines = 0,
|
int interhunkLines = 0,
|
||||||
}) {
|
}) {
|
||||||
|
libgit2.git_libgit2_init();
|
||||||
|
|
||||||
final int flagsInt =
|
final int flagsInt =
|
||||||
flags.fold(0, (previousValue, e) => previousValue | e.value);
|
flags.fold(0, (previousValue, e) => previousValue | e.value);
|
||||||
var result = <String, dynamic>{};
|
var result = <String, dynamic>{};
|
||||||
|
@ -83,6 +86,8 @@ class Patch {
|
||||||
///
|
///
|
||||||
/// Throws a [LibGit2Error] if error occured.
|
/// Throws a [LibGit2Error] if error occured.
|
||||||
Patch.fromDiff(Diff diff, int index) {
|
Patch.fromDiff(Diff diff, int index) {
|
||||||
|
libgit2.git_libgit2_init();
|
||||||
|
|
||||||
_patchPointer = bindings.fromDiff(diff.pointer, index);
|
_patchPointer = bindings.fromDiff(diff.pointer, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue