Pkg add 'at' or 'trackto' / @ or #

I don’t want to disturb too much for the development of Pkg3. I know you are quite busy.

Nevertheless, I find a bit misleading that @ is used to pin a tagged commit of the package but a SHA hash cannot be used instead of the tag. Documentation: Pkg → Adding registered packages.

Indeed one can pin the commit by using # which is supposed to track what’s next to it. It makes sense for a branch. Does it make for a commit? Maybe I’m missing something.

Besides, in the documentation seems that using ...@v0.4 and ...@0.4 are equivalents. Are they? Or it is typo? [UPDATE] They are equivalent.

Thanks

You mean that e.g.

(Pkg) pkg> pin JSON#master

doesn’t work? Yeah, that’s an oversight. You can do

pkg> add JSON#master

pkg> pin JSON

for now, but it would be good to support the first syntax as well.

OK. Why I cannot do for instance

(pkg) pkg> add JSON@f05dd3d26976ae8310cfb512cf0106505e95b51b
# equivalent to
(pkg) pkg> add JSON@v0.17.2 # or JSON@0.17.2 omitting v seems to work

Is a bit hard to test the syntax when lots of packages are broken, and everything is under dev.

This way @ pins the package and # tracks it. Sorry if that’s confusing.

OK I see that @ is to specify only tags… this way is easier for Pkg to handle specific versions instead of downloading the entire repository. Thanks for helping me to understand that.

Could Pkg live with only a single special char such as @ and check first if some version or tag exists for that and if not clone the repository to see if there is some branch or commit?

(pkg) pkg> add JSON@master
# check if there is a tag with the name master.... if not behave like JSON#master
(pkg) pkg> add JSON@v0.17.2
# check if there is a tag with the name master.... eureka!!

I guess it could work but it would disallow branches with the same name as tags.

1 Like

Git itself has to disbiguate that anyway so we could just give the same preference. Presumably one must prefer tags over branches.

1 Like

Opened https://github.com/JuliaLang/Pkg.jl/issues/487.