Matan Lurey e45fd36aac
Use an alternative to git describe for master version resolution (#174088)
Closes https://github.com/flutter/flutter/issues/173904.

It's not clear to me how `git describe --tags HEAD` ever ... worked to
determine a fallback. From what I can tell, the _intent_ was to use the
latest (newest? closest?) tag as the base version, and then append
`-{commitCount}-{shortHash}` as the fallback version number when on
`master` (or any non-published branch).

So, I rewrote the implementation, unfortunately with 4 separate calls
out to `git ...` instead of a single one.

There are 20+ tests that fail as a result of this change, mostly because
they make specific expectations around `git describe` being invoked, and
of course that is no longer the case - putting those aside, I'd like to
double check that:

1. I understand what the original command was _intending_ to do
2. We like the _output_ of the updated command
3. ... we either are okay with the implementation, or have an
alternative in mind (I'm no `git` master)

Wdyt?

At this commit:
```sh
$ flutter-dev --version                                                            
Flutter 3.36.0-1.0.pre-170 • channel [user-branch] • https://github.com/matanlurey/flutter
Framework • revision 250381a185 (5 minutes ago) • 2025-08-19 18:57:36 -0700
Engine • hash f278b0aa3b8c6732ab636563eb8e896c35fc9c79 (revision 9ac4facf7e) (2 hours ago) • 2025-08-19 23:42:28.000Z
Tools • Dart 3.10.0 (build 3.10.0-115.0.dev) • DevTools 2.49.0
```

/cc @zanderso @jmagman for historics.
2025-08-21 20:04:32 +00:00
..