Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
e7ab846d
Unverified
Commit
e7ab846d
authored
Mar 26, 2022
by
Anurag Roy
Committed by
GitHub
Mar 26, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Fix VersionUpstreamValidator to respect FLUTTER_GIT_URL (#100605)
parent
71ec251a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
version.dart
packages/flutter_tools/lib/src/version.dart
+11
-4
version_test.dart
packages/flutter_tools/test/general.shard/version_test.dart
+5
-5
No files found.
packages/flutter_tools/lib/src/version.dart
View file @
e7ab846d
...
...
@@ -449,15 +449,16 @@ class VersionUpstreamValidator {
// Strip `.git` suffix before comparing the remotes
final
List
<
String
>
sanitizedStandardRemotes
=
<
String
>[
if
(
flutterGit
!=
null
)
flutterGit
,
'https://github.com/flutter/flutter.git'
,
'git@github.com:flutter/flutter.git'
,
// If `FLUTTER_GIT_URL` is set, use that as standard remote.
if
(
flutterGit
!=
null
)
flutterGit
// Else use the predefined standard remotes.
else
...
_standardRemotes
,
].
map
((
String
remote
)
=>
stripDotGit
(
remote
)).
toList
();
final
String
sanitizedRepositoryUrl
=
stripDotGit
(
repositoryUrl
);
if
(!
sanitizedStandardRemotes
.
contains
(
sanitizedRepositoryUrl
))
{
if
(
platform
.
environment
.
containsKey
(
'FLUTTER_GIT_URL'
)
)
{
if
(
flutterGit
!=
null
)
{
// If `FLUTTER_GIT_URL` is set, inform to either remove the
// `FLUTTER_GIT_URL` environment variable or set it to the current
// tracking remote.
...
...
@@ -482,6 +483,12 @@ class VersionUpstreamValidator {
return
null
;
}
// The predefined list of remotes that are considered to be standard.
static
final
List
<
String
>
_standardRemotes
=
<
String
>[
'https://github.com/flutter/flutter.git'
,
'git@github.com:flutter/flutter.git'
,
];
// Strips ".git" suffix from a given string, preferably an url.
// For example, changes 'https://github.com/flutter/flutter.git' to 'https://github.com/flutter/flutter'.
// URLs without ".git" suffix will remain unaffected.
...
...
packages/flutter_tools/test/general.shard/version_test.dart
View file @
e7ab846d
...
...
@@ -379,17 +379,17 @@ void main() {
),
isNull
);
});
testWithoutContext
(
're
turns error at remote url and FLUTTER_GIT_URL set to different urls
'
,
()
{
testWithoutContext
(
're
spects FLUTTER_GIT_URL even if upstream remote url is standard
'
,
()
{
final
VersionCheckError
error
=
runUpstreamValidator
(
versionUpstreamUrl:
flutter
Non
StandardUrlDotGit
,
flutterGitUrl:
flutterStandardUrlDotGit
,
versionUpstreamUrl:
flutterStandardUrlDotGit
,
flutterGitUrl:
flutter
Non
StandardUrlDotGit
,
);
expect
(
error
,
isNotNull
);
expect
(
error
.
message
,
contains
(
'The Flutter SDK is tracking "
$flutter
NonStandardUrlDotGit
" but "FLUTTER_GIT_URL" is set to "
$flutter
StandardUrlDotGit
".
\n
'
'Either remove "FLUTTER_GIT_URL" from the environment or set it to "
$flutter
Non
StandardUrlDotGit
". '
'The Flutter SDK is tracking "
$flutter
StandardUrlDotGit
" but "FLUTTER_GIT_URL" is set to "
$flutterNon
StandardUrlDotGit
".
\n
'
'Either remove "FLUTTER_GIT_URL" from the environment or set it to "
$flutterStandardUrlDotGit
". '
'If this is intentional, it is recommended to use "git" directly to manage the SDK.'
),
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment