mirror of
https://github.com/flutter/flutter.git
synced 2026-01-15 09:52:34 +08:00
The content hash doesn't exist for local engine changes, except for on CI. If we detect we're on a branch with committed or uncommitted changes to engine files; use "master". towards #171790 re-land attempt for #173114 (try 2) re-land attempt for #172792 (original) The first commit in this PR is the previously LGTM'd changes for the above; with tests. The second commit is the critical change to make this work in post submits (fixes #173143). It turns out that while LUCI reports the GitHub private branches; our recipes directly checkout the git sha. This matters because the content scripts couldn't determine the branch name and the rev-parse was just HEAD. This lead the scripts down the merge-base logic, which returns the previous commit. A test was added specifically for this. Alternatively to this change, we could have checked for LUCI_CONTEXT being present in the environment. This is checked by Flutter tools in some cases, but not by any other scripts in `bin/internal`. The downside to checking HEAD: if you have a local branch with engine changes and you move back a revision - `dart`/`flutter` invocations will generate the hash for your local changes and fail.