Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1diff --git a/dev/bots/prepare_package.dart b/dev/bots/prepare_package.dart 2index 468a91a954..5def6897ce 100644 3--- a/dev/bots/prepare_package.dart 4+++ b/dev/bots/prepare_package.dart 5@@ -525,7 +525,7 @@ class ArchiveCreator { 6 7 Future<String> _runGit(List<String> args, {Directory? workingDirectory}) { 8 return _processRunner.runProcess( 9- <String>['git', ...args], 10+ <String>['git', '--git-dir', '.git', ...args], 11 workingDirectory: workingDirectory ?? flutterRoot, 12 ); 13 } 14diff --git a/packages/flutter_tools/lib/src/version.dart b/packages/flutter_tools/lib/src/version.dart 15index f2068a6ca2..99b161689e 100644 16--- a/packages/flutter_tools/lib/src/version.dart 17+++ b/packages/flutter_tools/lib/src/version.dart 18@@ -106,7 +106,7 @@ class FlutterVersion { 19 String? channel = _channel; 20 if (channel == null) { 21 final String gitChannel = _runGit( 22- 'git rev-parse --abbrev-ref --symbolic @{u}', 23+ 'git --git-dir .git rev-parse --abbrev-ref --symbolic @{u}', 24 globals.processUtils, 25 _workingDirectory, 26 ); 27@@ -114,7 +114,7 @@ class FlutterVersion { 28 if (slash != -1) { 29 final String remote = gitChannel.substring(0, slash); 30 _repositoryUrl = _runGit( 31- 'git ls-remote --get-url $remote', 32+ 'git --git-dir .git ls-remote --get-url $remote', 33 globals.processUtils, 34 _workingDirectory, 35 ); 36@@ -326,7 +326,7 @@ class FlutterVersion { 37 /// the branch name will be returned as `'[user-branch]'`. 38 String getBranchName({ bool redactUnknownBranches = false }) { 39 _branch ??= () { 40- final String branch = _runGit('git rev-parse --abbrev-ref HEAD', globals.processUtils); 41+ final String branch = _runGit('git --git-dir .git rev-parse --abbrev-ref HEAD', globals.processUtils); 42 return branch == 'HEAD' ? channel : branch; 43 }(); 44 if (redactUnknownBranches || _branch!.isEmpty) { 45@@ -359,7 +359,7 @@ class FlutterVersion { 46 /// wrapper that does that. 47 @visibleForTesting 48 static List<String> gitLog(List<String> args) { 49- return <String>['git', '-c', 'log.showSignature=false', 'log'] + args; 50+ return <String>['git', '-c', 'log.showSignature=false', '--git-dir', '.git', 'log'] + args; 51 } 52 53 /// Gets the release date of the latest available Flutter version. 54@@ -730,7 +730,7 @@ class GitTagVersion { 55 56 static GitTagVersion determine(ProcessUtils processUtils, {String? workingDirectory, bool fetchTags = false, String gitRef = 'HEAD'}) { 57 if (fetchTags) { 58- final String channel = _runGit('git rev-parse --abbrev-ref HEAD', processUtils, workingDirectory); 59+ final String channel = _runGit('git --git-dir .git rev-parse --abbrev-ref HEAD', processUtils, workingDirectory); 60 if (channel == 'dev' || channel == 'beta' || channel == 'stable') { 61 globals.printTrace('Skipping request to fetchTags - on well known channel $channel.'); 62 } else { 63@@ -739,7 +739,7 @@ class GitTagVersion { 64 } 65 // find all tags attached to the given [gitRef] 66 final List<String> tags = _runGit( 67- 'git tag --points-at $gitRef', processUtils, workingDirectory).trim().split('\n'); 68+ 'git --git-dir .git tag --points-at $gitRef', processUtils, workingDirectory).trim().split('\n'); 69 70 // Check first for a stable tag 71 final RegExp stableTagPattern = RegExp(r'^\d+\.\d+\.\d+$'); 72@@ -760,7 +760,7 @@ class GitTagVersion { 73 // recent tag and number of commits past. 74 return parse( 75 _runGit( 76- 'git describe --match *.*.* --long --tags $gitRef', 77+ 'git --git-dir .git describe --match *.*.* --long --tags $gitRef', 78 processUtils, 79 workingDirectory, 80 )