Unverified Commit bb402700 authored by Greg Spencer's avatar Greg Spencer Committed by GitHub

Add more debug output to snippet git failures (#83806)

parent 8f866ab5
......@@ -23,9 +23,12 @@ const String _kShowDartPad = 'dartpad';
String getChannelName() {
final RegExp gitBranchRegexp = RegExp(r'^## (?<branch>.*)');
final ProcessResult gitResult = Process.runSync('git', <String>['status', '-b', '--porcelain']);
final ProcessResult gitResult = Process.runSync('git', <String>['status', '-b', '--porcelain'], environment: <String, String>{
'GIT_TRACE': '2',
'GIT_TRACE_SETUP': '2',
}, includeParentEnvironment: true);
if (gitResult.exitCode != 0)
throw 'git status exit with non-zero exit code: ${gitResult.exitCode}';
throw 'git status exit with non-zero exit code: ${gitResult.exitCode}: ${gitResult.stderr}';
final RegExpMatch? gitBranchMatch = gitBranchRegexp.firstMatch(
(gitResult.stdout as String).trim().split('\n').first);
return gitBranchMatch == null ? '<unknown>' : gitBranchMatch.namedGroup('branch')!.split('...').first;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment