[flutter_tools] use -f when fetching tags (#58703)
use -f to overwrite local tags on master branch
diff --git a/packages/flutter_tools/lib/src/version.dart b/packages/flutter_tools/lib/src/version.dart
index 75b186e..e798a36 100644
--- a/packages/flutter_tools/lib/src/version.dart
+++ b/packages/flutter_tools/lib/src/version.dart
@@ -749,7 +749,7 @@
if (channel == 'dev' || channel == 'beta' || channel == 'stable') {
globals.printTrace('Skipping request to fetchTags - on well known channel $channel.');
} else {
- _runGit('git fetch $_flutterGit --tags', processUtils, workingDirectory);
+ _runGit('git fetch $_flutterGit --tags -f', processUtils, workingDirectory);
}
}
final List<String> tags = _runGit(
diff --git a/packages/flutter_tools/test/general.shard/version_test.dart b/packages/flutter_tools/test/general.shard/version_test.dart
index 6d7fa7f..1cd95ca 100644
--- a/packages/flutter_tools/test/general.shard/version_test.dart
+++ b/packages/flutter_tools/test/general.shard/version_test.dart
@@ -573,7 +573,7 @@
environment: anyNamed('environment'),
)).thenReturn(RunResult(ProcessResult(108, 0, 'master', ''), <String>['git', 'fetch']));
when(processUtils.runSync(
- <String>['git', 'fetch', 'https://github.com/flutter/flutter.git', '--tags'],
+ <String>['git', 'fetch', 'https://github.com/flutter/flutter.git', '--tags', '-f'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).thenReturn(RunResult(ProcessResult(109, 0, '', ''), <String>['git', 'fetch']));
@@ -599,7 +599,7 @@
environment: anyNamed('environment'),
)).called(1);
verify(processUtils.runSync(
- <String>['git', 'fetch', 'https://github.com/flutter/flutter.git', '--tags'],
+ <String>['git', 'fetch', 'https://github.com/flutter/flutter.git', '--tags', '-f'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).called(1);