Skip to content

Commit

Permalink
Fix #101 again
Browse files Browse the repository at this point in the history
#141 made some changes, however I forgot that `content` has different error handling behaviour than `cat`. This is a bit of a kludge, but hopefully should work.
  • Loading branch information
simonbyrne authored Apr 23, 2018
1 parent c648209 commit f9a4c94
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/entry.jl
Original file line number Diff line number Diff line change
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)
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 f9a4c94

Please sign in to comment.