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
c8efcb63
Unverified
Commit
c8efcb63
authored
Mar 28, 2020
by
Dan Field
Committed by
GitHub
Mar 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only fetch tags when not on dev/beta/stable (#53450)
parent
dfc3318e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
4 deletions
+61
-4
version.dart
packages/flutter_tools/lib/src/version.dart
+6
-1
version_test.dart
packages/flutter_tools/test/general.shard/version_test.dart
+55
-3
No files found.
packages/flutter_tools/lib/src/version.dart
View file @
c8efcb63
...
...
@@ -722,7 +722,12 @@ class GitTagVersion {
static
GitTagVersion
determine
(
ProcessUtils
processUtils
,
{
String
workingDirectory
,
bool
fetchTags
=
false
})
{
if
(
fetchTags
)
{
_runGit
(
'git fetch
$_flutterGit
--tags'
,
processUtils
,
workingDirectory
);
final
String
channel
=
_runGit
(
'git rev-parse --abbrev-ref HEAD'
,
processUtils
,
workingDirectory
);
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
);
}
}
return
parse
(
_runGit
(
'git describe --match v*.*.* --first-parent --long --tags'
,
processUtils
,
workingDirectory
));
}
...
...
packages/flutter_tools/test/general.shard/version_test.dart
View file @
c8efcb63
...
...
@@ -428,6 +428,11 @@ void main() {
GitTagVersion
.
determine
(
processUtils
,
workingDirectory:
'.'
);
verifyNever
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
));
verifyNever
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'fetch'
,
'https://github.com/flutter/flutter.git'
,
'--tags'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
...
...
@@ -440,21 +445,68 @@ void main() {
)).
called
(
1
);
});
testUsingContext
(
'determine
calls fetch --tags
'
,
()
{
testUsingContext
(
'determine
does not fetch tags on dev/stable/beta
'
,
()
{
final
MockProcessUtils
processUtils
=
MockProcessUtils
();
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
105
,
0
,
'dev'
,
''
),
<
String
>[
'git'
,
'fetch'
]));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'fetch'
,
'https://github.com/flutter/flutter.git'
,
'--tags'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
10
5
,
0
,
''
,
''
),
<
String
>[
'git'
,
'fetch'
]));
)).
thenReturn
(
RunResult
(
ProcessResult
(
10
6
,
0
,
''
,
''
),
<
String
>[
'git'
,
'fetch'
]));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'describe'
,
'--match'
,
'v*.*.*'
,
'--first-parent'
,
'--long'
,
'--tags'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
106
,
0
,
'v0.1.2-3-1234abcd'
,
''
),
<
String
>[
'git'
,
'describe'
]));
)).
thenReturn
(
RunResult
(
ProcessResult
(
107
,
0
,
'v0.1.2-3-1234abcd'
,
''
),
<
String
>[
'git'
,
'describe'
]));
GitTagVersion
.
determine
(
processUtils
,
workingDirectory:
'.'
,
fetchTags:
true
);
verify
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
called
(
1
);
verifyNever
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'fetch'
,
'https://github.com/flutter/flutter.git'
,
'--tags'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
));
verify
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'describe'
,
'--match'
,
'v*.*.*'
,
'--first-parent'
,
'--long'
,
'--tags'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
called
(
1
);
});
testUsingContext
(
'determine calls fetch --tags on master'
,
()
{
final
MockProcessUtils
processUtils
=
MockProcessUtils
();
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
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'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
109
,
0
,
''
,
''
),
<
String
>[
'git'
,
'fetch'
]));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'describe'
,
'--match'
,
'v*.*.*'
,
'--first-parent'
,
'--long'
,
'--tags'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
110
,
0
,
'v0.1.2-3-1234abcd'
,
''
),
<
String
>[
'git'
,
'describe'
]));
GitTagVersion
.
determine
(
processUtils
,
workingDirectory:
'.'
,
fetchTags:
true
);
verify
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
called
(
1
);
verify
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'fetch'
,
'https://github.com/flutter/flutter.git'
,
'--tags'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
...
...
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