-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[flutter_tools] Have FlutterValidator fail on non-ideal git config #103259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you pull some of this logic into helper methods? This cascade of if/else's is very difficult for my poor brain to parse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made each statement have its separate function returning ValidationMessage. Hope that suffices.
4d5d1e0 to
e6f6019
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, when is this value 0.0.0-unknown? And can you add a comment with the answer so I don't ask you next time :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be before run the validator on line 544?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than doing this check for gitUrl != null, can we not re-use the error message of upstreamValidationError? If that doesn't make sense, I think we should at least sub-class VersionCheckError for the different types of errors, rather than doing a check for the value of gitUrl here. It would be better for that implementation detail to be encapsulated inside of the VersionUpstreamValidator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That actually sounds like a good idea.
0ef7ca3 to
38bb6eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be a hint? is it not a legitimate state to be in to be on a non-release branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because I want to nudge users towards hints that might cause flutter upgrade to fail. The tool sets channel unknown if the branch doesn't have an upstream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem like this message gives the user actionable information, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we recommend the user to reinstall here(and other errors where applicable)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if the if i'm tracking branch delta from my own mirror? Won't that also resolve to "Unknown"? This seems like a reasonable workflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tool parses the information from this command for the channel:
flutter/packages/flutter_tools/lib/src/version.dart
Lines 113 to 114 in c181e45
| final String gitChannel = _runGit( | |
| 'git rev-parse --abbrev-ref --symbolic $kGitTrackingUpstream', |
and sets 'unknown' if the above returns nothing(or fails), which shouldn't be possible if the current branch is tracking something, be it a remote or a local branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, ok, I assumed we were validating that this was in a known set. Thanks for educating me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the assumption here that git describe ... outputted something we can't parse?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
8377c7b to
edb657d
Compare
christopherfujino
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This is what I have in mind:
|
Jasguerrero
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
edb657d to
0057438
Compare
Fixes #102035.
Makes the version and the upstream repository message display an issue in cases where
flutter upgradeis not supported.Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.