Weird Pkg.update() behavior (again)

Using Julia 0.6.1 on Windows, Pkg.update() fails:

julia> Pkg.update()
INFO: Updating METADATA...
INFO: Updating LoewnerJohnEllipsoids master...
INFO: Updating EarthOrientation master...
INFO: Updating PolygonClipping master...
INFO: Updating QHull master...
INFO: Updating ReferenceFrames master...
INFO: Updating Astrodynamics master...
INFO: Computing changes...
INFO: Upgrading BinDeps: v0.8.0 => v0.8.1
INFO: Upgrading DataStructures: v0.7.2 => v0.7.3
INFO: Upgrading IterTools: v0.1.0 => v0.2.0
INFO: Upgrading JSON: v0.16.2 => v0.16.3
INFO: Upgrading LinearMaps: v1.0.3 => v1.0.4
INFO: Upgrading OnlineStatsBase: v0.3.0 => v0.3.1
INFO: Upgrading PlotlyJS: v0.7.1 => v0.8.0
INFO: Upgrading Plots: v0.14.0 => v0.14.1
INFO: Upgrading URIParser: v0.2.0 => v0.3.0
INFO: Rolling back Plots from v0.14.1 to v0.14.0
INFO: Rolling back PlotlyJS from v0.8.0 to v0.7.1
INFO: Rolling back OnlineStatsBase from v0.3.1 to v0.3.0
INFO: Rolling back LinearMaps from v1.0.4 to v1.0.3
INFO: Rolling back JSON from v0.16.3 to v0.16.2
INFO: Rolling back IterTools from v0.2.0 to v0.1.0
INFO: Rolling back DataStructures from v0.7.3 to v0.7.2
INFO: Rolling back BinDeps from v0.8.1 to v0.8.0
ERROR: GitError(Code:ERROR, Class:Odb, Invalid pack file - invalid packfile type in header)
Stacktrace:
 [1] macro expansion at .\libgit2\error.jl:99 [inlined]
 [2] #fetch#41(::Base.LibGit2.FetchOptions, ::String, ::Function, ::Base.LibGit2.GitRemote, ::Array{String,1}) at .\libgit2\remote.jl:226
 [3] (::Base.LibGit2.#kw##fetch)(::Array{Any,1}, ::Base.LibGit2.#fetch, ::Base.LibGit2.GitRemote, ::Array{String,1}) at .\<missing>:0
 [4] #fetch#84(::String, ::String, ::Array{String,1}, ::Nullable{Base.LibGit2.AbstractCredentials}, ::Function, ::Base.LibGit2.GitRepo) at .\libgit2\libgit2.jl:312
 [5] (::Base.LibGit2.#kw##fetch)(::Array{Any,1}, ::Base.LibGit2.#fetch, ::Base.LibGit2.GitRepo) at .\<missing>:0
 [6] fetch(::Base.LibGit2.GitRepo, ::String, ::String) at .\pkg\write.jl:15
 [7] #3 at .\pkg\write.jl:53 [inlined]
 [8] with(::Base.Pkg.Write.##3#4{String,String}, ::Base.LibGit2.GitRepo) at .\libgit2\types.jl:608
 [9] resolve(::Dict{String,Base.Pkg.Types.VersionSet}, ::Dict{String,Dict{VersionNumber,Base.Pkg.Types.Available}}, ::Dict{String,Tuple{VersionNumber,Bool}}, ::Dict{String,Base.Pkg.Types.Fixed}, ::Dict{String,VersionNumber}, ::Set{String}) at .\pkg\entry.jl:542
 [10] update(::String, ::Set{String}) at .\pkg\entry.jl:461
 [11] (::Base.Pkg.Dir.##4#7{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}})() at .\pkg\dir.jl:36
 [12] cd(::Base.Pkg.Dir.##4#7{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}}, ::String) at .\file.jl:59
 [13] #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{Any,N} where N) at .\pkg\dir.jl:36
 [14] update() at .\pkg\pkg.jl:228

Note that all of the upgraded packages are rolled back to the previous version immediately, in addition to the update failing altogether because of an “invalid pack file”.

Running git fsck --full in ~/.julia/v0.6/URIParser/ showed all kinds of errors, so I removed URIParser from ~/.julia/v0.6/ and ~/.julia/.cache/ and re-added it with Pkg.add("URIParser"), and now things seem to work. :man_shrugging: