Ok Pkg itself.
We can ignore for now the Pkg server stuff, since that assumes it acts primarily as a caching layer, and there is still some canonical source it goes to get from if it doesn’t have it.
(Maybe that can change, but not what i want to comment on right now.)
First thing to note is that the Registry itself contains nothing of your git history.
What it contains is a repo URL
and a list of git-tree-shas for each version
plus some stuff for sorting out dependencies.
Its notable that it is a Tree-Sha, not a commit sha, so it is ties only to the content of the release, not to the actual git history assoicated with that.
According to Stefan Karpinski, Pkg itself by design is supposed to not be too tied to git.
Such that it should be fairly reasonable to swap out to another version control.
(I was considering if it would be viable to make Pijul work at one point)
Pkg.add
(rather than dev
) is even less tied to git already.
(again ignoring the Pkg server stuff):
Using git
is the fallback for Pkg.add.
Before resorting to that it checks if the repo URL (in the registry) is for github.
(*which is a bit gross special casing GitHub like that, but it got us performance that was really wanted for 1.0 release. If other providers had similar API then they should be added).
If it is, then it doesn’t touch git
at all.
It does a direct fetch from the URL given by:
https://github.com/JuliaLang/Pkg.jl/blob/cd24a9282d4874565858209b88acbfcd9212684e/src/Operations.jl#L524
"https://api.github.com/repos/$(repoowner)/$(reponame)/tarball/$(tree-hash)"
It seems like it would be fairly feasibly (technically, not nesc socially),
to have a similar special case for a server that can host arbitary content addressed tarballs.
Seetting repo to:
http://www.HostingServer.com/$(repoowner)/$(reponame)
and having that trigger a download to
http://www.HostingServer.com/$(repoowner)/$(reponame)/tarball/$(tree-hash)"
though since it would not be a git repo operations like dev
that do reley on it being being a git server will break.
But anyway to loop back round and with relevents to Fredrick’s suggestion of a public repo that only contains releases:
because it is only depending on the tree-hash, that means you just need to have the content the same to get it to work for download if on github.
SO i think
So you could have a private repo that has full history,
and a private package registry that points to it.
and a public repo only has releases, which you insert without any history preserved – like delete all files, make a commit, add all files from the release, make a commit.
and the neat thing is, you would be able to directly copy paste the Versions.toml file from your private registry to the public one.
All the tree-sha’s would be the same.
(only the Package.toml would need to have the URL changed)