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

install should install and update according to the .lock #65

Closed
jhass opened this issue Oct 17, 2015 · 10 comments
Closed

install should install and update according to the .lock #65

jhass opened this issue Oct 17, 2015 · 10 comments
Labels
Milestone

Comments

@jhass
Copy link
Member

jhass commented Oct 17, 2015

Let's have a project and a library

$ tree
├── libs
│   └── library
│       └── shard.yml
├── shard.lock
└── shard.yml
$ cat shard.yml
name: "project"
version: 0.1.0
dependencies:
  library:
    git: ../../library
    branch: master
$ cat shard.lock
version: 1.0
shards:
  library:
    git: ../../library
    commit: 1c5d802a00011557294c15eef52f387a0d551f23
$ cd ..
$ git --git-dir=library/.git log --oneline -1
6b0b9e8 new file

Let's clone our project to install it somewhere else:

$ git clone project clone
$ cd clone
$ shards
Updating ../../library
Updating ../../library
Updating ../../library
Updating ../../library
Updating ../../library
Installing library (1c5d802a00011557294c15eef52f387a0d551f23)
Updating ../../library
Updating ../../library
$ tree
Updating ../../library
Updating ../../library
Updating ../../library
Updating ../../library
Updating ../../library
Installing library (1c5d802a00011557294c15eef52f387a0d551f23)
Updating ../../library
Updating ../../library
$ tree
.
├── libs
│   └── library
│       ├── library.cr
│       ├── new_file.cr
│       └── shard.yml
├── shard.lock
└── shard.yml
$  cat shard.lock
version: 1.0
shards:
  library:
    git: ../../library
    commit: 1c5d802a00011557294c15eef52f387a0d551f23

Okay, first bug, lock is still the same, output has claimed to install 1c5d802a, actually installed is 6b0b9e8.

Let's get rid of that clone, update the lock to 6b0b9e8 and clone and install again.

$ cd ..
$ rm -rf clone
$ cd project
$ shards

Mkay, we called install, lock stays the same but the worktree is the updated version again. But that's probably the same bug as above. Time to update the lock. Then let's clone our project again and install

$ shards update
$ git commit -am "update library"
$ cd ..
$ git clone project clone
$ cd clone
$ shards

Everything good so far. Time to fix something in the library.

$ cd ..
$ cd library
$ touch src/fix.cr
$ git add src
$ git commit -m "fix"
$ cd ../project
$ shards update
$ git commit -am "update library again"
$ cd ../clone
$ git pull
$ shards
Updating ../../library
Updating ../../library
Updating ../../library
Updating ../../library
Updating ../../library
Using library (94417f573623cce28f69d26fdf1dc09cccd75b2d)
$ tree
.
├── libs
│   └── library
│       ├── library.cr
│       ├── new_file.cr
│       └── shard.yml
├── shard.lock
└── shard.yml

2 directories, 5 files

And now we got the above bug in reverse, install claimed it installed 94417f5 but the worktree wasn't updated.

@ysbaddaden ysbaddaden modified the milestones: v0.5.2, v0.6.0 Oct 19, 2015
@ysbaddaden
Copy link
Contributor

@ysbaddaden
Copy link
Contributor

Can you confirm this is fixed? Or do you still have bugs with locked commits? If everything's OK, I'll release v0.5.3 and upload binaries, which would fix #69

@ysbaddaden ysbaddaden modified the milestones: v0.5.3, v0.6.0 Oct 21, 2015
@jhass
Copy link
Member Author

jhass commented Oct 21, 2015

Mmh, actually the second case still doesn't work, the worktree isn't updated:

$ cd clone
$ tree ../library/ ../project/
../library/
├── shard.yml
└── src
    ├── fix2.cr
    ├── fix.cr
    ├── library.cr
    ├── new_file2.cr
    └── new_file.cr
../project/
├── libs
│   └── library
│       ├── fix2.cr
│       ├── fix.cr
│       ├── library.cr
│       ├── new_file2.cr
│       ├── new_file.cr
│       └── shard.yml
├── shard.lock
└── shard.yml
$ git --git-dir "../library/.git" log --oneline -1
7a0376c fix 2
$ cat shard.lock
version: 1.0
shards:
  library:
    git: ../../library
    commit: 7a0376c65c81753a5d60b5af815fa370f0c4be80

$ shards
Updating ../../library
Updating ../../library
Updating ../../library
Using library (7a0376c65c81753a5d60b5af815fa370f0c4be80)
$ tree
.
├── libs
│   └── library
│       ├── fix.cr
│       ├── library.cr
│       ├── new_file.cr
│       └── shard.yml
├── shard.lock
└── shard.yml

@ysbaddaden
Copy link
Contributor

Exact. Hopefully this is now fixed.

@jhass
Copy link
Member Author

jhass commented Oct 21, 2015

Well, you broke your testsuite :)

@jhass
Copy link
Member Author

jhass commented Oct 21, 2015

And I'm getting

$ cd clone
$ git pull
$ shards
Updating ../../library
Updating ../../library
Updating ../../library
Installing library ()
Updating ../../library
git command failed: git ls-tree -r --full-tree --name-only  -- shard.yml ()

@ysbaddaden
Copy link
Contributor

version: 1.0
shards:
  web:
    git: file:////home/julien/work/github/shards/test/.repositories/web
    commit: 

Seems like the broken test catched it. The sha1 is missing in the lock file.

@ysbaddaden
Copy link
Contributor

Fixed? Maybe...

@ysbaddaden ysbaddaden reopened this Oct 22, 2015
@jhass
Copy link
Member Author

jhass commented Oct 22, 2015

Looks good to me!

@jhass jhass closed this as completed Oct 22, 2015
@ysbaddaden
Copy link
Contributor

Cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants