mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
refactor(stash): reset stash list at the end of the method
This commit is contained in:
parent
6d48ae742c
commit
5401717713
1 changed files with 5 additions and 2 deletions
|
@ -128,10 +128,13 @@ var _stashList = <Stash>[];
|
||||||
/// Loop over all the stashed states.
|
/// Loop over all the stashed states.
|
||||||
List<Stash> list(Pointer<git_repository> repo) {
|
List<Stash> list(Pointer<git_repository> repo) {
|
||||||
const except = -1;
|
const except = -1;
|
||||||
_stashList.clear();
|
|
||||||
git_stash_cb callBack = Pointer.fromFunction(_stashCb, except);
|
git_stash_cb callBack = Pointer.fromFunction(_stashCb, except);
|
||||||
libgit2.git_stash_foreach(repo, callBack, nullptr);
|
libgit2.git_stash_foreach(repo, callBack, nullptr);
|
||||||
return _stashList;
|
|
||||||
|
final result = _stashList.toList(growable: false);
|
||||||
|
_stashList.clear();
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stashCb(
|
int _stashCb(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue