Skip to content

Commit

Permalink
improve error message for failed fetch (fix #8702): print where to fi…
Browse files Browse the repository at this point in the history
…le issues (URL if possible)

(cherry picked from commit b2844a9)
ref: #8711
  • Loading branch information
stevengj authored and ivarne committed Dec 15, 2014
1 parent 1588014 commit 31b8fb6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions base/pkg/read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,11 @@ function free(inst::Dict=installed())
return pkgs
end

function issue_url(pkg::String)
ispath(pkg,".git") || return ""
m = match(Git.GITHUB_REGEX, url(pkg))
m == nothing && return ""
return "https://github.com/" * m.captures[1] * "/issues"
end

end # module
7 changes: 6 additions & 1 deletion base/pkg/write.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ function fetch(pkg::String, sha1::String)
Git.run(`fetch -q $(Cache.path(pkg)) $refspec`, dir=pkg)
Git.iscommit(sha1, dir=pkg) && return
f = Git.iscommit(sha1, dir=Cache.path(pkg)) ? "fetch" : "prefetch"
error("$pkg: $f failed to get commit $(sha1[1:10]), please file a bug")
url = Read.issue_url(pkg)
if isempty(url)
error("$pkg: $f failed to get commit $(sha1[1:10]), please file a bug report with the package author.")
else
error("$pkg: $f failed to get commit $(sha1[1:10]), please file an issue at $url")
end
end

function checkout(pkg::String, sha1::String)
Expand Down

0 comments on commit 31b8fb6

Please sign in to comment.