Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency with Private Repo and dependency_overrides doesn't run "dart pub outdated" #4504

Open
Tox46 opened this issue Jan 24, 2025 · 3 comments
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@Tox46
Copy link

Tox46 commented Jan 24, 2025

Environment

I've reproduced the bug on Mac and on linux (Debian), but i've not tried yet on Windows

Debian

  • Dart version: Dart SDK version: 3.6.0 (stable) (Thu Dec 5 07:46:24 2024 -0800) on "linux_x64"
  • OS kind and version: Debian GNU/Linux 12 (bookworm) x86_64
  • Are you using the Chinese community mirror or a corporate firewall? no

Mac

  • Dart version: Dart SDK version: 3.6.1 (stable) (Tue Jan 7 09:50:00 2025 -0800) on "macos_arm64"
  • OS kind and version: MacOS Sonoma 14.6.1
  • Are you using the Chinese community mirror or a corporate firewall? no

Problem

dependencies:
  my_private_package:
    git:
      url: git@github.com:MyName/MyPrivateRepo.git
      ref: main

dependency_overrides:
  my_private_package:
    path: ../my_private_package

This is a trimmed version of my pubspec.yaml. It is written in such way that a sister folder always contains the package we refer to, or the environment we run in always has every entitlement to download the package from my private repo.

When running dart pub outdated the terminal always gives the same error, whether adding --dependency-overrides or --no-dependency-overrides. Here's one example of the output i get:

roberto@debian:~/$ dart pub outdated --dependency-overrides
Git error. Command: `git clone --mirror git@github.com:MyName/MyPrivateRepo.git /home/roberto/.pub-cache/_temp/dirKJZDSE`
stdout: 
stderr: Cloning into bare repository '/home/roberto/.pub-cache/_temp/dirKJZDSE'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

exit code: 128
roberto@debian:~/$ dart pub outdated --no-dependency-overrides
Git error. Command: `git clone --mirror git@github.com:MyName/MyPrivateRepo.git /home/roberto/.pub-cache/_temp/dirVMXQWK`
stdout: 
stderr: Cloning into bare repository '/home/roberto/.pub-cache/_temp/dirVMXQWK'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

exit code: 128

Expected behavior

I expect at least one of these two commands to work, but both ignore the dependency_overrides

@Tox46 Tox46 changed the title Dependency with Private Repo and Dependency Overrides doesn't run dart pub outdated Dependency with Private Repo and dependency_overrides doesn't run "dart pub outdated" Jan 25, 2025
@sigurdm sigurdm added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Feb 6, 2025
@sigurdm
Copy link
Contributor

sigurdm commented Feb 6, 2025

Yeah - this doesn't look right. I will try to investigate.

@sigurdm
Copy link
Contributor

sigurdm commented Feb 6, 2025

Ah now I understand!

pub outdated is trying to find the version for the latest column - and that never takes the override into account - which usually makes good sense. But here it should probably fall back to not showing a latest at all.

Maybe the latest column should only ever be filled for hosted (or version-tagged git dependencies)?
And maybe that logic expands to all the columns - they should perhaps not be shown at all for path and git dependencies.

@jonasfj do you have an opinion here?

@jonasfj
Copy link
Member

jonasfj commented Feb 14, 2025

I'm not sure, you can do pub upgrade on a git-dependency, right?

A workaround here, if my_private_package and root application is in the same repository is to use workspaces.


I think it might be okay for dart pub outdated --dependency-overrides to enforce dependency_overrides and not attempt to find out what the latest version of an overwritten dependency is. Because, well we're told to respect dependency-overrides.

I guess the question here is what does pub upgrade do? It won't attempt to upgrade a dependency_override I'm assuming?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants