crystal-lang / shards

Dependency manager for the Crystal language
Other
763 stars 100 forks source link

The branch parameter isn't working #474

Closed erdnaxeli closed 3 years ago

erdnaxeli commented 3 years ago

I have this:

dependencies:
  swagger:
    github: erdnaxeli/swagger
    branch: property_ref

I correctly see in the lockfile the expected commit:

shards:
  swagger:
    git: https://github.com/erdnaxeli/swagger.git
    version: 0.2.2+git.commit.de66eff378a12c0793f195f6220b02520676232

But when I go to lib/swagger and do git status I see the code is not the one expected.

$ shards --version
Shards 0.13.0 [dfb6a87] (2021-01-21)
$ crystal --version
Crystal 0.36.1 [c3a3c1823] (2021-02-02)

LLVM: 10.0.0
Default target: x86_64-unknown-linux-gnu
Blacksmoke16 commented 3 years ago

I'm pretty sure git status is showing you the branch of your project, not lib/swagger. As far as I know libs aren't cloned when doing shards install, it's just the checked out code from the related repo at that branch.

erdnaxeli commented 3 years ago

Yes, the code is actually cloned in "~/.cache/shards`. But the code is still not the one I expect on this branch.

This is what shards is doing:

Fetching https://github.com/erdnaxeli/swagger.git
git clone -c core.askPass=true --mirror --quiet -- https://github.com/erdnaxeli/swagger.git /home/erdnaxeli/.cache/shards/github.com/erdnaxeli/swagger.git
git ls-tree -r --full-tree --name-only de66eff378a12c0793f195f6220b025206762326 -- shard.yml
git show de66eff378a12c0793f195f6220b025206762326:shard.yml
git ls-remote --get-url origin
Installing swagger (0.2.2 at de66eff)
rm -rf /home/erdnaxeli/codaz/laspatule/lib/swagger
git --work-tree=/home/erdnaxeli/codaz/laspatule/lib/swagger checkout de66eff378a12c0793f195f6220b025206762326 -- .
Link /home/erdnaxeli/codaz/laspatule/lib to /home/erdnaxeli/codaz/laspatule/lib/swagger/lib

shards is using the commit de66eff instead of the last commit for this branch dc5cd76.

erdnaxeli commented 3 years ago

Ok I needed to run shards update to update my lockfile, this was obvious, sorry… I was running shards lock but it does not update the lockfile…