Unverified Commit e7d70fbf authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Revert "Fix version command for certain git workflows (#52062)" (#52128)

This reverts commit 20bf43b9.
parent a14ac4e3
......@@ -23,9 +23,6 @@ enum Channel {
stable,
}
/// The flutter GitHub repository.
const String _flutterGit = 'https://github.com/flutter/flutter.git';
/// Retrieve a human-readable name for a given [channel].
///
/// Requires [FlutterVersion.officialChannels] to be correctly ordered.
......@@ -236,7 +233,7 @@ class FlutterVersion {
'remote',
'add',
_versionCheckRemote,
_flutterGit,
'https://github.com/flutter/flutter.git',
]);
await _run(<String>['git', 'fetch', _versionCheckRemote, branch]);
return _latestGitCommitDate(
......@@ -705,7 +702,6 @@ class GitTagVersion {
final String hash;
static GitTagVersion determine(ProcessUtils processUtils, [String workingDirectory]) {
_runGit('git fetch $_flutterGit --tags', processUtils, workingDirectory);
return parse(_runGit('git describe --match v*.*.* --first-parent --long --tags', processUtils, workingDirectory));
}
......
......@@ -229,12 +229,6 @@ void main() {
setUp(() {
Cache.disableLocking();
fakeProcessManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(
command: <String>[
'git', 'fetch', 'https://github.com/flutter/flutter.git', '--tags',
],
stdout: 'From https://github.com/flutter/flutter\n * branch HEAD -> FETCH_HEAD',
),
const FakeCommand(
command: <String>[
'git', 'describe', '--match', 'v*.*.*', '--first-parent', '--long', '--tags',
......
......@@ -165,8 +165,6 @@ void main() {
workingDirectory: Cache.flutterRoot)).thenReturn(result);
when(processManager.runSync(FlutterVersion.gitLog('-n 1 --pretty=format:%ar'.split(' ')),
workingDirectory: Cache.flutterRoot)).thenReturn(result);
when(processManager.runSync('git fetch https://github.com/flutter/flutter.git --tags'.split(' '),
workingDirectory: Cache.flutterRoot)).thenReturn(result);
when(processManager.runSync('git describe --match v*.*.* --first-parent --long --tags'.split(' '),
workingDirectory: Cache.flutterRoot)).thenReturn(result);
when(processManager.runSync(FlutterVersion.gitLog('-n 1 --pretty=format:%ad --date=iso'.split(' ')),
......
......@@ -7,7 +7,6 @@ import 'dart:convert';
import 'package:collection/collection.dart' show ListEquality;
import 'package:flutter_tools/src/base/context.dart';
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/process.dart';
import 'package:flutter_tools/src/base/time.dart';
import 'package:flutter_tools/src/base/utils.dart';
import 'package:flutter_tools/src/cache.dart';
......@@ -412,33 +411,6 @@ void main() {
'Could not interpret results of "git describe": v1.2.3-4-gxabcdef\n',
);
});
testUsingContext('determine calls fetch --tags', () {
final MockProcessUtils processUtils = MockProcessUtils();
when(processUtils.runSync(
<String>['git', 'fetch', 'https://github.com/flutter/flutter.git', '--tags'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).thenReturn(RunResult(ProcessResult(105, 0, '', ''), <String>['git', 'fetch']));
when(processUtils.runSync(
<String>['git', 'describe', '--match', 'v*.*.*', '--first-parent', '--long', '--tags'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).thenReturn(RunResult(ProcessResult(106, 0, 'v0.1.2-3-1234abcd', ''), <String>['git', 'describe']));
GitTagVersion.determine(processUtils, '.');
verify(processUtils.runSync(
<String>['git', 'fetch', 'https://github.com/flutter/flutter.git', '--tags'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).called(1);
verify(processUtils.runSync(
<String>['git', 'describe', '--match', 'v*.*.*', '--first-parent', '--long', '--tags'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).called(1);
});
}
void _expectVersionMessage(String message) {
......@@ -517,8 +489,6 @@ void fakeData(
// Careful here! argsAre accepts 9 arguments and FlutterVersion.gitLog adds 4.
} else if (remoteCommitDate != null && listArgsAre(FlutterVersion.gitLog(<String>['__flutter_version_check__/$channel', '-n', '1', '--pretty=format:%ad', '--date=iso']))) {
return success(remoteCommitDate.toString());
} else if (argsAre('git', 'fetch', 'https://github.com/flutter/flutter.git', '--tags')) {
return success('');
}
throw StateError('Unexpected call to ProcessManager.run(${invocation.positionalArguments}, ${invocation.namedArguments})');
......@@ -549,18 +519,13 @@ void fakeData(
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).thenReturn(ProcessResult(104, 0, '1 second ago', ''));
when(pm.runSync(
<String>['git', 'fetch', 'https://github.com/flutter/flutter', '--tags'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).thenReturn(ProcessResult(105, 0, '', ''));
when(pm.runSync(
<String>['git', 'describe', '--match', 'v*.*.*', '--first-parent', '--long', '--tags'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).thenReturn(ProcessResult(106, 0, 'v0.1.2-3-1234abcd', ''));
)).thenReturn(ProcessResult(105, 0, 'v0.1.2-3-1234abcd', ''));
}
class MockProcessManager extends Mock implements ProcessManager {}
class MockProcessUtils extends Mock implements ProcessUtils {}
class MockCache extends Mock implements Cache {}
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