Skip to content

For devs who git pull instead of flutter upgrade, version calculation is wrong #15529

@tvolkert

Description

@tvolkert

Steps to Reproduce

# Fetch remote refs on March 6 and not since
$ git pull upstream master
$ git reset --hard 4c7cc73
$ flutter doctor

Expected Behavior

Because version 0.2.1 has been tagged at 6f5bcb9, the version should be v0.2.2-pre.45

Actual Behavior

The version is reported as v0.1.9-pre.124, which indicates that the last tag the tool sees is v0.1.8. Looking at the contents of my local tags confirms this:

$ ll .git/refs/tags/
total 224
drwxr-xr-x  30 tvolkert  eng  960 Mar  6 10:35 .
drwxr-xr-x   6 tvolkert  eng  192 Mar  6 10:36 ..
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.10
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.11
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.12
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.13
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.14
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.15
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.16
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.17
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.18
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.19
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.20
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.21
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.22
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.23
-rw-r--r--   1 tvolkert  eng   41 Feb  7 16:52 v0.0.24
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.6
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.7
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.8
-rw-r--r--   1 tvolkert  eng   41 Feb  7 09:41 v0.0.9
-rw-r--r--   1 tvolkert  eng   41 Feb 26 11:38 v0.1.0
-rw-r--r--   1 tvolkert  eng   41 Feb 26 11:38 v0.1.1
-rw-r--r--   1 tvolkert  eng   41 Feb 26 11:38 v0.1.2
-rw-r--r--   1 tvolkert  eng   41 Feb 26 11:38 v0.1.3
-rw-r--r--   1 tvolkert  eng   41 Feb 26 11:38 v0.1.4
-rw-r--r--   1 tvolkert  eng   41 Feb 26 11:38 v0.1.5
-rw-r--r--   1 tvolkert  eng   41 Feb 26 11:38 v0.1.6
-rw-r--r--   1 tvolkert  eng   41 Mar  1 08:25 v0.1.7
-rw-r--r--   1 tvolkert  eng   41 Mar  6 10:35 v0.1.8

The only way I see to solve this is to make flutter doctor fetch upstream refs, but that could have unintended consequences... @Hixie thoughts?


Edit by @christopherfujino
As this issue has had a complicated history of related PRs and issues, I've listed the ones that I could find here for reference:

03/14/2018 - Issue #15529 - this issue
03/05/2020 - PR #52062 - First fix for version command
03/06/2020 - Issue #52121 - Regression caused by #52062
03/06/2020 - PR #52128 - Revert of #52062
03/06/2020 - PR #52141 - Second fix, reland but only in doctor
03/06/2020 - Issue #52161 - flutter version command hangs on dev 1.15.18
03/08/2020 - PR #52212 - Third fix, for version command
03/09/2020 - PR #52250 - Fourth fix, for upgrade/build ios commands

Metadata

Metadata

Assignees

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