Skip to content

Shards dependency does not accept a specific commit when a version is required too #683

@BigBoyBarney

Description

@BigBoyBarney

If a project requires multiple shards, one of which specifies the other, specifying a commit for that one becomes impossible, short of using a shard.override

Steps to reproduce:

  1. Create a new shard and push (https://codeberg.org/Sylphrena/one)
  2. Create another shard and push (https://codeberg.org/Sylphrena/two)
  • To better illustrate a real-world example, set version of this shard to 0.2.0 (optional)
  1. Make shard one require shard two with version >= 0.1.0 for example
  2. Tag both shards, one with v0.1.0 and two with v0.2.0
  3. Create a new shards file using shards init somewhere and add the two shards as dependencies.
name: shards-test
version: 0.1.0

dependencies:
  one:
    codeberg: sylphrena/one
    version: 0.1.0

  two:
    codeberg: sylphrena/two
    version: 0.2.0
  1. Run shards install and notice that it works.
  2. Delete the lock file
  3. Change the new shard.yml to specify a commit, it can even be the one that's tagged, doesn't matter.
name: shards-test
version: 0.1.0

dependencies:
  one:
    codeberg: sylphrena/one
    version: 0.1.0

  two:
    codeberg: sylphrena/two
    commit: 95d6a271ed01c4a4228a2fe6ef641451f469cb8c
  1. Run shards install and notice that it does not work
Resolving dependencies
Fetching https://codeberg.org/sylphrena/one.git
Fetching https://codeberg.org/sylphrena/two.git
Unable to satisfy the following requirements:

- `two (commit 95d6a27)` required by `shard.yml`
- `two (>=0.1.0)` required by `one 0.1.0`
Failed to resolve dependencies

Even though commit 95d6a27 is a tagged version 0.2.0 which worked previously.


Would it be possible to have shards reconcile this difference? I know it can be solved by using a shard.override, but it'd be neat if that weren't necessary. This is also the case when 2 dependencies require the same shard, one with the version and one with the commit.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions