mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[flutter_tools] flutter version reports picks up release versions (#63019)
This commit is contained in:
parent
ca660aad09
commit
c9cd825fca
@ -783,7 +783,7 @@ class GitTagVersion {
|
||||
// recent tag and number of commits past.
|
||||
return parse(
|
||||
_runGit(
|
||||
'git describe --match *.*.*-*.*.pre --first-parent --long --tags',
|
||||
'git describe --match *.*.* --first-parent --long --tags',
|
||||
processUtils,
|
||||
workingDirectory,
|
||||
)
|
||||
@ -858,7 +858,7 @@ class GitTagVersion {
|
||||
if (devPatch != null && devVersion != null) {
|
||||
return '$x.$y.$z-${devVersion + 1}.0.pre.$commits';
|
||||
}
|
||||
return '$x.$y.${z + 1}.pre.$commits';
|
||||
return '$x.$y.${z + 1}-0.0.pre.$commits';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ class MockProcessManager extends Mock implements ProcessManager {
|
||||
return ProcessResult(0, 0, '000000000000000000000', '');
|
||||
}
|
||||
if (commandStr ==
|
||||
'git describe --match *.*.*-*.*.pre --first-parent --long --tags') {
|
||||
'git describe --match *.*.* --first-parent --long --tags') {
|
||||
if (version.isNotEmpty) {
|
||||
return ProcessResult(0, 0, '$version-0-g00000000', '');
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ void main() {
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>[
|
||||
'git', 'describe', '--match', '*.*.*-*.*.pre', '--first-parent', '--long', '--tags',
|
||||
'git', 'describe', '--match', '*.*.*', '--first-parent', '--long', '--tags',
|
||||
],
|
||||
stdout: 'v1.12.16-19-gb45b676af',
|
||||
),
|
||||
|
@ -187,7 +187,7 @@ void main() {
|
||||
workingDirectory: Cache.flutterRoot)).thenReturn(result);
|
||||
when(processManager.runSync('git tag --contains HEAD'.split(' '),
|
||||
workingDirectory: Cache.flutterRoot)).thenReturn(result);
|
||||
when(processManager.runSync('git describe --match *.*.*-*.*.pre --first-parent --long --tags'.split(' '),
|
||||
when(processManager.runSync('git describe --match *.*.* --first-parent --long --tags'.split(' '),
|
||||
workingDirectory: Cache.flutterRoot)).thenReturn(result);
|
||||
when(processManager.runSync(FlutterVersion.gitLog('-n 1 --pretty=format:%ad --date=iso'.split(' ')),
|
||||
workingDirectory: Cache.flutterRoot)).thenReturn(result);
|
||||
|
@ -419,7 +419,7 @@ void main() {
|
||||
expect(gitTagVersion.devPatch, 5);
|
||||
|
||||
gitTagVersion = GitTagVersion.parse('1.2.3-13-g$hash');
|
||||
expect(gitTagVersion.frameworkVersionFor(hash), '1.2.4.pre.13');
|
||||
expect(gitTagVersion.frameworkVersionFor(hash), '1.2.4-0.0.pre.13');
|
||||
expect(gitTagVersion.gitTag, '1.2.3');
|
||||
expect(gitTagVersion.devVersion, null);
|
||||
expect(gitTagVersion.devPatch, null);
|
||||
@ -433,12 +433,12 @@ void main() {
|
||||
|
||||
// new tag release format, stable channel
|
||||
gitTagVersion = GitTagVersion.parse('1.2.3-13-g$hash');
|
||||
expect(gitTagVersion.frameworkVersionFor(hash), '1.2.4.pre.13');
|
||||
expect(gitTagVersion.frameworkVersionFor(hash), '1.2.4-0.0.pre.13');
|
||||
expect(gitTagVersion.gitTag, '1.2.3');
|
||||
expect(gitTagVersion.devVersion, null);
|
||||
expect(gitTagVersion.devPatch, null);
|
||||
|
||||
expect(GitTagVersion.parse('98.76.54-32-g$hash').frameworkVersionFor(hash), '98.76.55.pre.32');
|
||||
expect(GitTagVersion.parse('98.76.54-32-g$hash').frameworkVersionFor(hash), '98.76.55-0.0.pre.32');
|
||||
expect(GitTagVersion.parse('10.20.30-0-g$hash').frameworkVersionFor(hash), '10.20.30');
|
||||
expect(testLogger.traceText, '');
|
||||
expect(GitTagVersion.parse('v1.2.3+hotfix.1-4-g$hash').frameworkVersionFor(hash), '0.0.0-unknown');
|
||||
@ -475,7 +475,7 @@ void main() {
|
||||
// We shouldn't have to fallback to git describe, because we are exactly
|
||||
// on a release tag.
|
||||
verifyNever(mockProcessUtils.runSync(
|
||||
<String>['git', 'describe', '--match', '*.*.*-*.*.pre', '--first-parent', '--long', '--tags'],
|
||||
<String>['git', 'describe', '--match', '*.*.*', '--first-parent', '--long', '--tags'],
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
environment: anyNamed('environment'),
|
||||
));
|
||||
@ -489,7 +489,7 @@ void main() {
|
||||
environment: anyNamed('environment'),
|
||||
)).thenReturn(RunResult(ProcessResult(105, 0, '', ''), <String>['git', 'fetch']));
|
||||
when(processUtils.runSync(
|
||||
<String>['git', 'describe', '--match', '*.*.*-*.*.pre', '--first-parent', '--long', '--tags'],
|
||||
<String>['git', 'describe', '--match', '*.*.*', '--first-parent', '--long', '--tags'],
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
environment: anyNamed('environment'),
|
||||
)).thenReturn(RunResult(ProcessResult(106, 0, 'v0.1.2-3-1234abcd', ''), <String>['git', 'describe']));
|
||||
@ -515,7 +515,7 @@ void main() {
|
||||
environment: anyNamed('environment'),
|
||||
));
|
||||
verify(processUtils.runSync(
|
||||
<String>['git', 'describe', '--match', '*.*.*-*.*.pre', '--first-parent', '--long', '--tags'],
|
||||
<String>['git', 'describe', '--match', '*.*.*', '--first-parent', '--long', '--tags'],
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
environment: anyNamed('environment'),
|
||||
)).called(1);
|
||||
@ -534,7 +534,7 @@ void main() {
|
||||
environment: anyNamed('environment'),
|
||||
)).thenReturn(RunResult(ProcessResult(106, 0, '', ''), <String>['git', 'fetch']));
|
||||
when(processUtils.runSync(
|
||||
<String>['git', 'describe', '--match', '*.*.*-*.*.pre', '--first-parent', '--long', '--tags'],
|
||||
<String>['git', 'describe', '--match', '*.*.*', '--first-parent', '--long', '--tags'],
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
environment: anyNamed('environment'),
|
||||
)).thenReturn(RunResult(ProcessResult(107, 0, 'v0.1.2-3-1234abcd', ''), <String>['git', 'describe']));
|
||||
@ -560,7 +560,7 @@ void main() {
|
||||
environment: anyNamed('environment'),
|
||||
));
|
||||
verify(processUtils.runSync(
|
||||
<String>['git', 'describe', '--match', '*.*.*-*.*.pre', '--first-parent', '--long', '--tags'],
|
||||
<String>['git', 'describe', '--match', '*.*.*', '--first-parent', '--long', '--tags'],
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
environment: anyNamed('environment'),
|
||||
)).called(1);
|
||||
@ -587,7 +587,7 @@ void main() {
|
||||
<String>['git', 'tag', '--contains', 'HEAD'],
|
||||
));
|
||||
when(processUtils.runSync(
|
||||
<String>['git', 'describe', '--match', '*.*.*-*.*.pre', '--first-parent', '--long', '--tags'],
|
||||
<String>['git', 'describe', '--match', '*.*.*', '--first-parent', '--long', '--tags'],
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
environment: anyNamed('environment'),
|
||||
)).thenReturn(RunResult(ProcessResult(111, 0, 'v0.1.2-3-1234abcd', ''), <String>['git', 'describe']));
|
||||
@ -605,7 +605,7 @@ void main() {
|
||||
environment: anyNamed('environment'),
|
||||
)).called(1);
|
||||
verify(processUtils.runSync(
|
||||
<String>['git', 'describe', '--match', '*.*.*-*.*.pre', '--first-parent', '--long', '--tags'],
|
||||
<String>['git', 'describe', '--match', '*.*.*', '--first-parent', '--long', '--tags'],
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
environment: anyNamed('environment'),
|
||||
)).called(1);
|
||||
@ -632,7 +632,7 @@ void main() {
|
||||
<String>['git', 'tag', '--contains', 'HEAD'],
|
||||
));
|
||||
when(processUtils.runSync(
|
||||
<String>['git', 'describe', '--match', '*.*.*-*.*.pre', '--first-parent', '--long', '--tags'],
|
||||
<String>['git', 'describe', '--match', '*.*.*', '--first-parent', '--long', '--tags'],
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
environment: anyNamed('environment'),
|
||||
)).thenReturn(RunResult(ProcessResult(111, 0, 'v0.1.2-3-1234abcd', ''), <String>['git', 'describe']));
|
||||
@ -770,7 +770,7 @@ void fakeData(
|
||||
environment: anyNamed('environment'),
|
||||
)).thenReturn(ProcessResult(106, 0, '', ''));
|
||||
when(pm.runSync(
|
||||
<String>['git', 'describe', '--match', '*.*.*-*.*.pre', '--first-parent', '--long', '--tags'],
|
||||
<String>['git', 'describe', '--match', '*.*.*', '--first-parent', '--long', '--tags'],
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
environment: anyNamed('environment'),
|
||||
)).thenReturn(ProcessResult(107, 0, 'v0.1.2-3-1234abcd', ''));
|
||||
|
Loading…
Reference in New Issue
Block a user