Install a specific commit for unregistered package?


#1

I’m trying to install a specific commit of a unregistered package. I tried with Pkg.pin but that’s only available with registered packages; and Pkg.clone does not have any method for that. Is it possible to install a specific commit of a repo? I’m in 0.6.2.


#2

clone and then checkout?


#3

Easiest way is to clone, open up GitKraken, click to make a branch at that commit, and then stay there.


#4

Do you mean something like this?

Pkg.clone("<pkg name>")
repo = LibGit2.GitRepo(joinpath(Pkg.dir(), "<pkg name>"))
LibGit2.branch!(repo, "Pin_<sha commit>", "<sha commit>")

New branch is necessary to avoid Pkg.update() to “unpin”… ? (I didn’t check it)


#5

No, just call Pkg.clone and then Pkg.checkout.


#6

I only have the SHA of the commit. The package doesn’t have any branches, just master and many commits. Pkg.checkout expects a branch.


#7

Ah, too bad. I wonder why, given that git commands generally accept either a branch or a commit.


#8

Just go to .julia/v0.6/Package and checkout the commit.