Skip to content

Commit

Permalink
Merge pull request #142 from JuliaLang/sb/fixcat
Browse files Browse the repository at this point in the history
Fix #101 again
  • Loading branch information
simonbyrne committed Apr 24, 2018
2 parents c648209 + a554ee8 commit 2082d43
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/entry.jl
Expand Up @@ -73,8 +73,17 @@ function publish(branch::AbstractString, prbranch::AbstractString="")
m !== nothing && occursin(Base.VERSION_REGEX, m.captures[2]) || continue
pkg, ver = m.captures; ver = VersionNumber(ver)
sha1 = readchomp(joinpath(metapath,path))
old = LibGit2.content(LibGit2.GitBlob(repo, "origin/$branch:$path"))
old !== nothing && old != sha1 && throw(Pkg.PkgError("$pkg v$ver SHA1 changed in METADATA – refusing to publish"))
try
old = LibGit2.content(LibGit2.GitBlob(repo, "origin/$branch:$path"))
if old != sha1
throw(Pkg.PkgError("$pkg v$ver SHA1 changed in METADATA – refusing to publish"))
end
catch e
if !(e isa LibGit2.GitError && e.code == LibGit2.Error.ENOTFOUND)
rethrow(e)
end
end

with(LibGit2.GitRepo, PkgDev.dir(pkg)) do pkg_repo
tag_name = "v$ver"
tag_commit = LibGit2.revparseid(pkg_repo, "$(tag_name)^{commit}")
Expand Down

0 comments on commit 2082d43

Please sign in to comment.