I had this error from stack build, but I gather the problem is in pantry.
If I reference a repository on github, and set the commit hash to reference a commit found in a pull request made from a fork, I get the error fatal: Could not parse object '<hash>'. If I reference the repository that the PR was made from, it works fine.
For example (though this example won't work if the PR in question gets merged), if I have an extra-deps entry
- git: https://github.com/haskell-streaming/streaming-postgresql-simple
commit: 32762bdb7e352200ea3dd93f6466a060752baae6
referencing haskell-streaming/streaming-postgresql-simple#3, I get the error:
$ stack build --fast
Cloning 32762bdb7e352200ea3dd93f6466a060752baae6 from https://github.com/haskell-streaming/streaming-postgresql-simple
Received ExitFailure 128 when running
Raw command: /usr/bin/git reset --hard 32762bdb7e352200ea3dd93f6466a060752baae6
Run from: /tmp/with-repo949997/cloned
Standard error:
fatal: Could not parse object '32762bdb7e352200ea3dd93f6466a060752baae6'.
If I change the repository to https://github.com/ivan-m/streaming-postgresql-simple, I don't.
I can reproduce the error with git itself. After a clone, if I manually run the raw command:
$ git reset --hard 32762bdb7e352200ea3dd93f6466a060752baae6
fatal: Could not parse object '32762bdb7e352200ea3dd93f6466a060752baae6'.
An easy solution here is to fetch the commit explicitly:
$ git fetch origin 32762bdb7e352200ea3dd93f6466a060752baae6
remote: Enumerating objects: 42, done.
remote: Counting objects: 100% (14/14), done.
remote: Total 42 (delta 14), reused 14 (delta 14), pack-reused 28
Unpacking objects: 100% (42/42), 6.05 KiB | 344.00 KiB/s, done.
From github.com:haskell-streaming/streaming-postgresql-simple
* branch 32762bdb7e352200ea3dd93f6466a060752baae6 -> FETCH_HEAD
$ git reset --hard 32762bdb7e352200ea3dd93f6466a060752baae6
HEAD is now at 32762bd Re-export exceptions and connection functions from postgresql-simple
So I expect that adding this extra fetch to Pantry.Repo.withRepo would fix the issue. It does have a downside that the extra fetch takes a bit of extra time, even if the commit is already available. There's probably more complicated things that work to avoid that.
I had this error from
stack build, but I gather the problem is in pantry.If I reference a repository on github, and set the commit hash to reference a commit found in a pull request made from a fork, I get the error
fatal: Could not parse object '<hash>'.If I reference the repository that the PR was made from, it works fine.For example (though this example won't work if the PR in question gets merged), if I have an extra-deps entry
referencing haskell-streaming/streaming-postgresql-simple#3, I get the error:
If I change the repository to
https://github.com/ivan-m/streaming-postgresql-simple, I don't.I can reproduce the error with
gititself. After a clone, if I manually run the raw command:An easy solution here is to fetch the commit explicitly:
So I expect that adding this extra fetch to
Pantry.Repo.withRepowould fix the issue. It does have a downside that the extra fetch takes a bit of extra time, even if the commit is already available. There's probably more complicated things that work to avoid that.