Skip to content

Git dependencies don't work with relative PUB_CACHE #4493

Closed
@FireLizard

Description

@FireLizard

Environment

Dart Version: 3.6.1
OS: Ubuntu 22.04 LTS

Problem

When setting PUB_CACHE to a relative path like .pub-cache then dart pub get -v (output below) can not get information about a package included as git-repository defined in pubspec.yaml. Only if PUB_CACHE is an absolute path (e.g. $HOME/.pub-cache) it is working. With Dart Version 3.3.4 there was no issue.

Maybe we should document this circumstance.

pubspec.yaml

name: my_project
publish_to: 'none'
environment:
  sdk: ">=3.4.0 <4.0.0"
dependencies:
  some-package:
    git: https://github.com/vendor/repo.git

The git-repo does not have any tag. I don't define ref, therefore HEAD is used.

output

IO  : Spawning "git --git-dir=.pub-cache/git/cache/some-package-da7b21c760c51da18bebb4859505a5f86964ac9c show 512149311978d182854b46364d327cd0328a0834:pubspec.yaml" in /home/user/my_project/.pub-cache/git/cache/some-package-da7b21c760c51da18bebb4859505a5f86964ac9c
IO  : Finished git. Exit code 128.
    | Nothing output on stdout.
    | stderr:
    | | fatal: not a git repository: '.pub-cache/git/cache/some-package-da7b21c760c51da18bebb4859505a5f86964ac9c'
    | |

Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions