commercialhaskell / commercialhaskell/stack

re-cloning a git repo as a dependency

Open
#2,666 1 comment 0 reactions 0 assignees View on GitHub
awaiting pull request type: enhancement
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

### General summary/comments (optional)

When using a dependency specified as a git repository and hash, when the hash is changed to one that is newer the entire directory is deleted and recloned. For large repositories and/or slow or costly internet connections this can be very wasteful.

Is there any reason not to just do a `git fetch` on the repo, rather than complete re-clone?
### Steps to reproduce
1. Set up a stack project to use a git repo and hash as a dependency
2. Build the project
3. Push a new version to the dependency repo
4. Update the hash in the stack.yaml to reflect the new version
5. Do `stack build`
### Expected

I expect stack to do a `get fetch` and reset to the new commit hash.
### Actual

The messages show an attempted git reset to the new hash which fails, followed by deleting and re-cloning the entire dependency repository.
### Stack version

```
$ stack --version
Version 1.2.0, Git revision 241cd07d576d9c0c0e712e83d947e3dd64541c42 (4054 commits) x86_64 hpack-0.14.0
```
### Method of installation
- Official binary, installed via fpcomplete debian package

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.