mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 12:49:08 -04:00
test: add more tests for throws and their messages
This commit is contained in:
parent
d6eae1e9ed
commit
127849519d
80 changed files with 2741 additions and 1501 deletions
|
@ -37,29 +37,26 @@ class Branch {
|
|||
);
|
||||
}
|
||||
|
||||
/// Lookups a branch by its [name] in a [repo]sitory.
|
||||
/// Lookups a branch by its [name] and [type] in a [repo]sitory.
|
||||
///
|
||||
/// The branch name will be checked for validity.
|
||||
///
|
||||
/// Should be freed with [free] to release allocated memory when no longer
|
||||
/// needed.
|
||||
/// If branch [type] is [GitBranch.remote] you must include the remote name
|
||||
/// in the [name] (e.g. "origin/master").
|
||||
///
|
||||
/// Should be freed to release allocated memory when no longer needed.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Branch.lookup({required Repository repo, required String name}) {
|
||||
final ref = Reference(
|
||||
reference_bindings.lookupDWIM(
|
||||
repoPointer: repo.pointer,
|
||||
name: name,
|
||||
),
|
||||
);
|
||||
|
||||
Branch.lookup({
|
||||
required Repository repo,
|
||||
required String name,
|
||||
GitBranch type = GitBranch.local,
|
||||
}) {
|
||||
_branchPointer = bindings.lookup(
|
||||
repoPointer: repo.pointer,
|
||||
branchName: name,
|
||||
branchType: ref.isBranch ? GitBranch.local.value : GitBranch.remote.value,
|
||||
branchType: type.value,
|
||||
);
|
||||
|
||||
ref.free();
|
||||
}
|
||||
|
||||
late final Pointer<git_reference> _branchPointer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue