Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[flutter_tools] Remove usage of globals.flutterGit from version #100744

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

Merged
merged 2 commits into from
Apr 14, 2022

Conversation

royarg02
Copy link
Contributor

@royarg02 royarg02 commented Mar 25, 2022

Removes globals.flutterGit and its usage in version.

Now that the tool only uses FLUTTER_GIT_URL or github.com/flutter/flutter for version freshness check and updates(#97202 and #100605), we don't need to create the temporary remote anymore; instead use the tracking remote itself to fetch from upstream.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Mar 25, 2022
} on VersionCheckError catch (error) {
if (globals.platform.environment.containsKey('FLUTTER_GIT_URL')) {
globals.printWarning('Warning: the Flutter git upstream was overridden '
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this message as the user will hit a similar error message when they try to upgrade, and in the case FLUTTER_GIT_URL is set incorrectly, the upstream of the current channel has to be exactly the same for the tool to arrive at this point.

branch: '$_versionCheckRemote/$branch',
);
await _run(<String>['git', 'fetch', '--tags']);
return _gitCommitDate(gitRef: '@{u}');
Copy link
Contributor

@christopherfujino christopherfujino Apr 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good change; however, I always need to look up @{u}. Can you make this a constant, like:

/// A git shortcut for the branch that is being tracked by the current one.
///
/// See `man gitrevisions` for more information.
const String kGitTrackingUpstream = '@{upstream}';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

return _latestGitCommitDate(
branch: '$_versionCheckRemote/$branch',
);
await _run(<String>['git', 'fetch', '--tags']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it sounds like git fetch, without an explicit remote, defaults to whatever remote the current branch is tracking?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so, please leave a comment.

Copy link
Contributor Author

@royarg02 royarg02 Apr 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it sounds like git fetch, without an explicit remote, defaults to whatever remote the current branch is tracking?

Yes, provided the current branch tracks the said remote. Otherwise remote origin is fetched.
The tool won't go to the second case ever, since in that case repositoryUrl will be null and will fail this check.

Although I only mentioned that the tool fetches from upstream, I wouldn't necessarily object if you would like to have the above info included as well.

Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@Jasguerrero Jasguerrero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@royarg02 royarg02 force-pushed the cleanup_version branch 2 times, most recently from 3ebc203 to 5a10d36 Compare April 8, 2022 07:12
@fluttergithubbot fluttergithubbot merged commit ae805de into flutter:master Apr 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants