Skip to content

[flutter_tools] When reporting Flutter version, we should explicitly favor stable tags over dev tags #55332

@christopherfujino

Description

@christopherfujino

Consider Flutter framework revision abc123. When promoted from master to dev, it was given the tag 1.2.0-0.0.pre. It was then promoted as is to beta. It was then promoted as is to stable, and tagged 1.2.0.

When the flutter tool reports its version (to either flutter doctor, flutter --version, or usage), it parses the output of git describe --match *.*.* --tags --first-parent. In locally testing commits with multiple tags (e.g. 1.18.0-6.0.pre and 1.18.0), it seems to pick the correct tag (1.18.0), but I could not find documentation on how it resolves multiple tags on the same commit. This SO post also seems confusing.

To be safe, we should first check all tags on the current commit (e.g. git tag --contains HEAD), checking first for a stable tag, second for a dev/beta style tag. If none are found (i.e. we are on an untagged commit on master), fallback to using git describe.

Metadata

Metadata

Labels

toolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions