[opam-devel] opam pinning to local repo

Daniel Bünzli daniel.buenzli at erratique.ch
Mon Nov 17 12:06:38 GMT 2014

Le lundi, 17 novembre 2014 à 12:15, Thomas Leonard a écrit :
> I'd prefer a third option: use the files as they are in the working
> directory, but only those tracked by git. I often get bitten by opam
> copying untracked files (e.g. setup.data, setup.log, previous build
> artifacts) and giving strange results.
> I use the copy-if-tracked system when editing on my desktop but
> compiling on my cubieboard and it works well. You just have to
> remember to "git add" any new files... but that's a useful check
> anyway.
> (BTW, you can easily snapshot the current tracked files without
> changing anything with "git stash create", which outputs an anonymous
> commit ID if there are any changes relative to HEAD)

That's an interesting middle ground we didn't think about when we had the discussion about this [1]. While I was firmly (and still am) opposed to path pins because of the problems you mention, I do have to agree that having to commit/amend commit on my git-pins, which is what I do now, is sometimes painful. So you'd suggest something like rsync directory state in opam's build dir then:

git stash save -u
git clean -fxd
git checkout .
git stash pop  

Note that with the above procedure you don't have to `git add` untracked files, it relies on your .gitignore. If you prefer the (maybe safer) behaviour you suggest, remove the -u from the first command.  

Regarding the `git stash create` id for the watermark I am not very fond of that since by being anonymous it doesn't give me any context and/or useful information, I think I'd prefer the short last commit ID with -dirty appended.  



[1] https://github.com/ocaml/opam/issues/1555

More information about the opam-devel mailing list