From f9a4c940b62832265160a6e303068c85e487f277 Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Mon, 23 Apr 2018 16:33:17 -0700 Subject: [PATCH] Fix #101 again #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. --- src/entry.jl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/entry.jl b/src/entry.jl index 8272811..b619edf 100644 --- a/src/entry.jl +++ b/src/entry.jl @@ -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}")