-
Notifications
You must be signed in to change notification settings - Fork 390
opam pin add -k git in 1.2.2 vs 2.0 #3477
Description
Testing with 2.0 rc2, a workflow involving locally pinning a package during development doesn't work in 2.0. I'm not sure if I'm currently abusing 1.2.2 or if this is unintended behavior of 2.0.
With 1.2.2, I pin packages with:
$ cd /path/to/git/clone/root
$ cd my-lib-subdir
$ opam pin add -n -k git my-lib .
and opam happily reports:
my-lib is now git-pinned to /path/to/git/clone/root/my-lib
[NOTE] Pinning in mixed mode: OPAM will use tracked files in the current working tree from /path/to/git/clone/root/my-lib. If this is not what you want, pin to a
given branch (e.g. /path/to/git/clone/root/my-lib#HEAD)
But with 2.0 the analogous attempt fails:
$ opam pin add -n -k git my-lib .
[ERROR] Could not synchronize /Users/jjb/.opam2/4.07.0/.opam-switch/sources/my-lib from "git+file:///path/to/git/clone/root/my-lib#master":
"git fetch -q file:///path/to/git/clone/root/my-lib" exited with code 128
[ERROR] Error getting source from git+file:///path/to/git/clone/root/my-lib#master
[Exit 40]
It seems that 1.2.2 is able to git pin a subdirectory of the git repo, while 2.0 isn't.
I tried without -k git, but then opam copies the entire directory, which is very slow and heavy as usually there are many and large files not under source control (build and test artifacts).
I also tried opam install ./my-lib.opam --inplace-build which initially seems to do what I'm after, but also sets up an rsync pin, which hits on the next e.g. opam upgrade.
User error?