I have included a dependency directly from a local Git repository in my cabal.project file as follows:
packages: .
source-repository-package
type: git
location: /home/chris/example/
tag: master
subdir: abcxyz
Initially, running cabal build fetched the repository successfully, and the project compiled without issues. However, after updating the repository, I can't seem to find the correct way to make Cabal recognize these updates and fetch the latest commit. There are ways to clear the cache but then I'm deleting additional things and spending more time pulling and building things (which isn't very practical with frequent updates to the external repo).
I've tried rerunning cabal build and cabal update, but it seems Cabal does not check for updates to already fetched Git repositories like the above. I've also had a quick read through https://cabal.readthedocs.io/en/3.4/cabal-project.html but I don't see any mention of such functionality.
How could I do this?
I expect
cabalmodels tags as being immutable. Of course you and I know there's no way of enforcing this, but it does seem to be a pretty strong convention among git afficionados.If you plan on updating which commit you want to use frequently, switch from tags to commits:
Then update the commit listed in your
cabal.projectas needed.An alternative flow that does not require explicit updates of cabal (but does require explicit updates of git) is to make your other repository into a submodule. In your
cabal.project, put something likethen run a command like this:
Of course, if you want to be friendly to your colleagues, you'll need to make the repository available online rather than in
/home/chris, and refer to it there. But then this is true both of thesource-repository-packageapproach and of the submodule approach.