refactor!: return sets of git type flags instead of integers

This commit is contained in:
Aleksey Kulikov 2021-09-10 20:22:02 +03:00
parent 050c0eb57a
commit 7618f944c0
12 changed files with 459 additions and 191 deletions

View file

@ -1,7 +1,6 @@
import 'dart:io';
import 'dart:ffi';
import 'bindings/libgit2_bindings.dart';
import 'git_types.dart';
DynamicLibrary loadLibrary() {
if (Platform.isLinux || Platform.isAndroid || Platform.isFuchsia) {
@ -26,22 +25,3 @@ bool isValidShaHex(String str) {
return hexRegExp.hasMatch(str) &&
(GIT_OID_MINPREFIXLEN <= str.length && GIT_OID_HEXSZ >= str.length);
}
GitFilemode intToGitFilemode(int i) {
switch (i) {
case 0:
return GitFilemode.unreadable;
case 16384:
return GitFilemode.tree;
case 33188:
return GitFilemode.blob;
case 33261:
return GitFilemode.blobExecutable;
case 40960:
return GitFilemode.link;
case 57344:
return GitFilemode.commit;
default:
return GitFilemode.unreadable;
}
}