Reputation: 8136
I am using Haskell Stack, and the source code for the package I am building is on git. My stack.yaml
looks like this:
packages:
- location:
git: [email protected]:mhwombat/blah-blah-blah.git
commit: master
. . .
Everything builds fine. However, suppose the source code is updated in the repository. Stack doesn't fetch the latest version; it continues to use the version it already has. My solution so far is to delete .stack-work
and do another stack build
, but of course it has to rebuild everything. When you're using lens, that takes a loooong time.
Is there a way to force Stack to fetch the latest version from git?
Already tried stack update
and stack clean
, but they don't solve this problem.
Upvotes: 1
Views: 309
Reputation: 3045
There's one way, but it is tedious instead of master as the commit, place the SHA1 of the latest commit. You can get the latest commit by running:
git rev-parse origin/master
The output should look like this: de7059a7a7c81c9c8997cad6dce7cdbd5b6c09d9
Then in your stack.yaml you would place this:
packages:
- location:
git: [email protected]:mhwombat/blah-blah-blah.git
commit: de7059a7a7c81c9c8997cad6dce7cdbd5b6c09d9
. . .
And you would have "forced" stack to fetch the latest commit when you run stack build
no need to delete .stack-work
anymore. It's not as simple as a single command but it worked for me and was not too annoying, as a bonus for me it helped me freeze a dependency. This is scriptable since it only uses git, though it wasn't tiresome enough that I made a script.
Upvotes: 1