refactor(stash): reset stash list at the end of the method

This commit is contained in:
Aleksey Kulikov 2021-09-27 11:23:38 +03:00
parent 6d48ae742c
commit 5401717713

View file

@ -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(