[flutter_tools] Fix version cache git fallback performance regression#187400
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the Flutter version detection logic to support git worktrees by checking if .git is a directory or a file, refactors repositoryUrl retrieval to handle git command exit codes and fall back to the origin remote, and introduces validation for standard remote URLs. Feedback on these changes highlights a potential compilation error under Dart's sound null safety due to passing a nullable repositoryUrl to _isStandardRemote, and suggests adding the RFC-compliant SSH URL format to the list of standard remotes to avoid performance penalties.
Fixes a performance regression introduced in flutter#186595 where healthy SDK installations on developer or PR branches (detected as '[user-branch]') were treated as suspicious, forcing a slow Git fallback on every command. 1. Refined `isSuspicious` to check for non-standard `repositoryUrl` instead of `[user-branch]` channel. 2. Improved `repositoryUrl` detection to fallback to `origin` remote if no upstream is configured, ensuring healthy dev branches can resolve a standard remote. 3. Fixed `isGitRepo` check to support Git worktrees where `.git` is a file. 4. Added `ssh://git@github.com/flutter/flutter.git` to standard remotes list to support SSH environments. 5. Updated and fixed associated unit tests in `version_test.dart`, including a new test case for SSH standard remote.
72ce46a to
e76249e
Compare
Co-authored-by: Kevin Moore <kevmoo@users.noreply.github.com>
|
Thanks Kevin! Would you mind approving? :) |
|
...as lang as you get CI 💚 😎 |
Hopefully this fixes it! |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates FlutterVersion to support git worktrees by checking if .git is a file or directory, falls back to retrieving the origin remote URL if the upstream tracking branch is unavailable, and enhances suspicious cache detection by verifying if the repository URL is a standard remote or matches FLUTTER_GIT_URL. Feedback points out a potential compilation error under Dart's sound null safety because a nullable String? is passed to _isStandardRemote, which expects a non-nullable String, and suggests updating the helper function to accept a nullable parameter.
|
Ping @kevmoo 😄 |
|
autosubmit label was removed for flutter/flutter/187400, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR. |
flutter/flutter@8bdce07...b7cb925 2026-06-12 engine-flutter-autoroll@skia.org Roll Skia from cadbde1ec4b7 to 8c89bf2b0ee3 (5 revisions) (flutter/flutter#187926) 2026-06-12 engine-flutter-autoroll@skia.org Roll Packages from 1b56cde to b78ad83 (5 revisions) (flutter/flutter#187928) 2026-06-12 engine-flutter-autoroll@skia.org Roll Dart SDK from f3441f2067ae to f6c31f4c3a63 (17 revisions) (flutter/flutter#187924) 2026-06-12 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 2KosSR4ONUjIB7tP_... to A3eaUn9mQ_EkSNxVI... (flutter/flutter#187923) 2026-06-12 engine-flutter-autoroll@skia.org Roll Skia from a2228b926c68 to cadbde1ec4b7 (9 revisions) (flutter/flutter#187921) 2026-06-12 kustermann@google.com Remove dynamic module loading code in flutter web engine (flutter/flutter#187777) 2026-06-12 matt.kosarek@canonical.com Remove EnableTransparentWindowBackground because it did nothing important and because Windows 10 does not support DWMWA_SYSTEMBACKDROP_TYPE (flutter/flutter#187848) 2026-06-12 engine-flutter-autoroll@skia.org Roll Fuchsia Test Scripts from dQ4PjIJB5kZFU8Y32... to EmfiOMUge_nnNS33B... (flutter/flutter#187912) 2026-06-12 mvincentong@gmail.com Clarify RichText selection docs (flutter/flutter#186844) 2026-06-12 1063596+reidbaker@users.noreply.github.com Custom KGP task and migration to AGP api for geting kgp version (flutter/flutter#182788) 2026-06-12 engine-flutter-autoroll@skia.org Roll Skia from f61acb31edf8 to a2228b926c68 (5 revisions) (flutter/flutter#187896) 2026-06-12 bdero@google.com [Flutter GPU] Expose ASTC HDR texture formats (flutter/flutter#187715) 2026-06-12 awolff@google.com Expand coverage of android_hardware_smoke_test. Add image, text, blend mode, and blur tests. (flutter/flutter#187600) 2026-06-11 bdero@google.com [Flutter GPU] Add blit operations (flutter/flutter#187289) 2026-06-11 bkonyi@google.com [flutter_tools] Fix version cache git fallback performance regression (flutter/flutter#187400) 2026-06-11 nshahan@google.com Rewrite `-d web-server` hot reload/restart tests (flutter/flutter#187453) 2026-06-11 bdero@google.com [Impeller] Allow sampling textures with manually-uploaded mip levels (flutter/flutter#187729) 2026-06-11 154381524+flutteractionsbot@users.noreply.github.com Sync CHANGELOG.md from stable (flutter/flutter#187884) 2026-06-11 47866232+chunhtai@users.noreply.github.com iOS a11y sets header trait based on heading level (flutter/flutter#186916) 2026-06-11 engine-flutter-autoroll@skia.org Roll Skia from 9f02102df298 to f61acb31edf8 (19 revisions) (flutter/flutter#187869) 2026-06-11 engine-flutter-autoroll@skia.org Roll ICU from ee5f27adc28b to d578f2e8b7bd (8 revisions) (flutter/flutter#187829) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC louisehsu@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…flutter#187400) Fixes a performance regression introduced in flutter#186595 where healthy SDK installations on developer or PR branches (detected as '[user-branch]') were treated as suspicious, forcing a slow Git fallback on every command. 1. Refined `isSuspicious` to check for non-standard `repositoryUrl` instead of `[user-branch]` channel. 2. Improved `repositoryUrl` detection to fallback to `origin` remote if no upstream is configured, ensuring healthy dev branches can resolve a standard remote. 3. Fixed `isGitRepo` check to support Git worktrees where `.git` is a file. 4. Updated and fixed associated unit tests in `version_test.dart`. --------- Co-authored-by: Kevin Moore <kevmoo@users.noreply.github.com>
Fixes a performance regression introduced in #186595 where healthy SDK installations on developer or PR branches (detected as '[user-branch]') were treated as suspicious, forcing a slow Git fallback on every command.
isSuspiciousto check for non-standardrepositoryUrlinstead of[user-branch]channel.repositoryUrldetection to fallback tooriginremote if no upstream is configured, ensuring healthy dev branches can resolve a standard remote.isGitRepocheck to support Git worktrees where.gitis a file.version_test.dart.