From 9180d4da45ebae53719905b8da88acff7f9f6b5c Mon Sep 17 00:00:00 2001 From: Pascal Welsch Date: Tue, 5 Mar 2024 23:55:01 +0100 Subject: [PATCH] Fix cloning from local repo --- test/test/install_test.dart | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/test/install_test.dart b/test/test/install_test.dart index aa056a2..4a78ee4 100644 --- a/test/test/install_test.dart +++ b/test/test/install_test.dart @@ -142,10 +142,31 @@ void main() { bool _precached = false; Lock precacheLock = Lock(); +/// Allow to clone from file system to speed up tests +Future allowCloneFromFile() async { + // get current allow setting + String? allowValue; + try { + allowValue = await output('git config --global protocol.file.allow'); + } catch (e) { + // ignore, not set + } + print('allowValue: "$allowValue"'); + if (allowValue?.trim() != 'always') { + await run('git config --global protocol.file.allow always'); + + // always restore to previous value + addTearDown(() { + run('git config --global protocol.file.allow $allowValue'); + }); + } +} + Future runInstallScript({ required String appDir, required String gitRootDir, }) async { + await allowCloneFromFile(); const fs = LocalFileSystem(); final repoRoot = fs.currentDirectory.parent; // Get path from line