Skip to content

Flutter needs git>=2.36 since 2025-04-09 #175265

Closed

Description

@Meax5qiu

Steps to reproduce

I am on Linux Mint 21.2

$ git --version
git version 2.34.1
$ git clone https://github.com/flutter/flutter.git
$ flutter/bin/flutter doctor -v
error: unknown option `format'
usage: git ls-tree [<options>] <tree-ish> [<path>...]

    -d                    only show trees
    -r                    recurse into subtrees
    -t                    show trees when recursing
    -z                    terminate entries with NUL byte
    -l, --long            include object size
    --name-only           list only filenames
    --name-status         list only filenames
    --full-name           use full path names
    --full-tree           list entire tree; not just current directory (implies --full-name)
    --abbrev[=<n>]        use <n> digits to display object names

Downloading Linux x64 Dart SDK from Flutter engine e69de29bb2d1d6434b8b29ae775ad8c2e48c5391...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   255  100   255    0     0   1157      0 --:--:-- --:--:-- --:--:--  1159
[/_PATH_/flutter/bin/cache/dart-sdk-linux-x64.zip]
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of /_PATH_flutter/bin/cache/dart-sdk-linux-x64.zip or
        /_PATH_/flutter/bin/cache/dart-sdk-linux-x64.zip.zip, and cannot find /_PATH_/flutter/bin/cache/dart-sdk-linux-x64.zip.ZIP, period.

It appears that the downloaded file is corrupt; please try again.
If this problem persists, please report the problem at:
  https://github.com/flutter/flutter/issues/new?template=01_activation.yml

Actual results

Commit d2de6c6 introduced a call to git ls-tree --format ... into bin/internal/content_aware_hash.sh.

However, the --format option for git ls-tree has only been added in version 2.36 in April, 2022.

This required version of git is too recent to be available in Debian Bullseye, Ubuntu Jammy LTS, or systems of a similar age. This contradicts with the official documentation.

Ugly workaround: Downgrade the repo to 1f4f037 and skip any recent development.

Logs

Logs
<!-- Paste your logs here -->

Flutter Doctor output

Doctor output
$ flutter/bin/flutter doctor -v
error: unknown option `format'
usage: git ls-tree [<options>] <tree-ish> [<path>...]

    -d                    only show trees
    -r                    recurse into subtrees
    -t                    show trees when recursing
    -z                    terminate entries with NUL byte
    -l, --long            include object size
    --name-only           list only filenames
    --name-status         list only filenames
    --full-name           use full path names
    --full-tree           list entire tree; not just current directory (implies --full-name)
    --abbrev[=<n>]        use <n> digits to display object names

Downloading Linux x64 Dart SDK from Flutter engine e69de29bb2d1d6434b8b29ae775ad8c2e48c5391...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   255  100   255    0     0   1157      0 --:--:-- --:--:-- --:--:--  1159
[/_PATH_/flutter/bin/cache/dart-sdk-linux-x64.zip]
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of /_PATH_flutter/bin/cache/dart-sdk-linux-x64.zip or
        /_PATH_/flutter/bin/cache/dart-sdk-linux-x64.zip.zip, and cannot find /_PATH_/flutter/bin/cache/dart-sdk-linux-x64.zip.ZIP, period.

It appears that the downloaded file is corrupt; please try again.
If this problem persists, please report the problem at:
  https://github.com/flutter/flutter/issues/new?template=01_activation.yml

Activity

  1. Meax5qiu commented on Sep 12, 2025

    @Meax5qiu
    Author

    #172744 might have had the same root cause. (Then it would have been wrong to call it a duplicate of #66243

    Also likely a duplicate of #172838 although the original reporter there didn't seem to care about it afterwards.

  2. changed the title [-]Flutter needs git>=2.36[/-] [+]Flutter needs git>=2.36 since 2025-04-09[/+] on Sep 12, 2025
  3. jmagman commented on Sep 12, 2025

    @jmagman
    Member

    @jtmcdole heads up this looks like a regression from content aware hashing #166717
    Is there a way to change that git command to run on git versions that work on the supported Linux platforms https://docs.flutter.dev/get-started/install/linux/desktop#operating-system ?

  4. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    team-toolOwned by Flutter Tool team
    on Sep 12, 2025
  5. jtmcdole commented on Sep 12, 2025

    @jtmcdole
    Member

    Background

    The output is only critical in that it must include the "sha" (objectname) of the files request. Without the --format, we get objecttype, objectmode, and path. The hash is critical because that is combined with git hash-object --stdin to produce a single hash that is the fingerprint of the engine.

    This:

    git  ls-tree --format "%(objectname) %(path)" HEAD DEPS engine
    1ea6050c88a2c85ef26cc7b5c5e4ae5455e5cb9d DEPS
    5b1323e561e05c5b1d00a9142631748782f311c1 engine
    

    Vs:

    git  ls-tree   HEAD DEPS engine
    100644 blob 1ea6050c88a2c85ef26cc7b5c5e4ae5455e5cb9d	DEPS
    040000 tree 5b1323e561e05c5b1d00a9142631748782f311c1	engine
    

    To verify: the objectmode and path are not changed on Windows.

    Fixes / Work arounds

    If you need to work today:
    Use something like brew to update your git version. Debian 11 and Ubuntu 22.04 have 2.34.1, which was an update to a 2021 version for CVEs.

    If you want to wait:
    We need to verify that Windows doesn't change the output with the path and mode. If it doesn't, then we could update content_aware_hash.sh, content_aware_hash.ps1, and the workflow in the same PR.

    Technically we can probably update the workflow to use the script since we've updated the script to detect the merge queue.

  6. jtmcdole commented on Sep 12, 2025

    @jtmcdole
    Member

    Checking (now that my windows machine is booted):

    PS C:\src\flutter> git ls-tree HEAD -- DEPS engine bin/internal/release-candidate-branch.version
    100644 blob 3cf281fb38554829a7441439d48b1bfe0adb7b94    DEPS
    100644 blob 0ab4df5242b2f0f3cefce11e5fc9155ce71a95cf    bin/internal/release-candidate-branch.version
    040000 tree b17b2f009c89093288c8367eaa6ec7c1a35d64df    engine
    
    ❯ git ls-tree HEAD -- DEPS engine bin/internal/release-candidate-branch.version
    100644 blob 3cf281fb38554829a7441439d48b1bfe0adb7b94	DEPS
    100644 blob 0ab4df5242b2f0f3cefce11e5fc9155ce71a95cf	bin/internal/release-candidate-branch.version
    040000 tree b17b2f009c89093288c8367eaa6ec7c1a35d64df	engine
    

    The hash of both is identical e1f15838045a93121c00daf6b4cab54b957ce786.

  7. added
    P2Important issues not at the top of the work list
    triaged-toolTriaged by Flutter Tool team
    on Sep 15, 2025
  8. loic-sharma commented on Sep 17, 2025

    @loic-sharma
    Member

    If you need to work today:
    Use something like brew to update your git version.

    (Please excuse my rant). Depot tools on Windows breaks if you use git installed by a system package manager like scoop/winget/chocolatey. If you do engine development on Windows, you'll need to install/upgrade git manually using the Windows installer ☹️

  9. 4 remaining items

  10. loic-sharma commented on Sep 18, 2025

    @loic-sharma
    Member

    Are you having problems with this bug or is it just a general rant about depo tools being awful?

    Just a rant on depot tools. The git upgrade workaround worked for me :)

  11. philrittenhouse commented on Sep 30, 2025

    @philrittenhouse

    I have version 2.39.5 of git and I still get the error:

    error: unknown option `format'
    usage: git ls-tree [<options>] <tree-ish> [<path>...]
    
        -d                    only show trees
        -r                    recurse into subtrees
        -t                    show trees when recursing
        -z                    terminate entries with NUL byte
        -l, --long            include object size
        --name-only           list only filenames
        --name-status         list only filenames
        --full-name           use full path names
        --full-tree           list entire tree; not just current directory (implies --full-name)
        --abbrev[=<n>]        use <n> digits to display SHA-1s
    

    If I run $ git ls-tree --format manually however, I do not get the error. It seems flutter is using a different version of git than what I have installed?

    @loic-sharma did you have to do anything special to get flutter to use the upgraded git?

    I am running bookworm on a RPi zero 2w

    Thanks!
    Phil

  12. philrittenhouse commented on Sep 30, 2025

    @philrittenhouse

    It seems flutter is using a different version of git

    Yup. Turns out installing flutter with snap installs an older (incompatible) version of git with it.

  13. added 3 commits that reference this issue on Sep 30, 2025
    9324de0
    738ba03
    0a4886b
  14. added a commit that references this issue on Oct 4, 2025
    a9ea4b4
  15. added a commit that references this issue on Oct 7, 2025
    3bcb4d5
  16. added a commit that references this issue on Oct 7, 2025
    a955323
  17. github-actions commented on Oct 18, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  18. locked as resolved and limited conversation to collaborators on Oct 18, 2025
  19. added a commit that references this issue on Dec 10, 2025
    60fd408
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions