diff --git a/lib/checkout.dart b/lib/checkout.dart index c8f1cc7..440584e 100644 --- a/lib/checkout.dart +++ b/lib/checkout.dart @@ -1,4 +1,7 @@ +import 'dart:io'; + import 'package:path/path.dart' as p; +import 'package:os/file_system.dart' as os_fs; import 'package:dart_git/dart_git.dart'; import 'package:dart_git/diff_commit.dart'; @@ -128,7 +131,10 @@ extension Checkout on GitRepository { await fs .directory(p.join(workTree, p.dirname(to.path))) .create(recursive: true); - await fs.file(p.join(workTree, to.path)).writeAsBytes(blobObj.blobData); + + var filePath = p.join(workTree, to.path); + await fs.file(filePath).writeAsBytes(blobObj.blobData); + os_fs.chmodSync(File(filePath), change.to!.mode.val); await index.updatePath(to.path, to.hash); } else if (change.deleted) { diff --git a/pubspec.yaml b/pubspec.yaml index 0d4e87f..57326cf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,6 +13,8 @@ dependencies: file: ^6.1.0 freezed_annotation: ^0.14.1 meta: ^1.3.0 + os: + git: https://github.com/GitJournal/os.git path: ^1.8.0 quiver: ^3.0.0 tuple: ^2.0.0