Skip to content

Commit

Permalink
handle git cli errors as pkgerrors
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Jul 4, 2023
1 parent 2cd30ad commit dce46c2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/GitTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ function clone(io::IO, url, source_path; header=nothing, credentials=nothing, kw
end
try
if use_cli_git()
run(pipeline(`git clone --quiet $url $source_path`; stdout=devnull))
try
run(pipeline(`git clone --quiet $url $source_path`; stdout=devnull))
catch err
Pkg.Types.pkgerror("Git cli failed to clone from '$(url)', error: $err")
end
return LibGit2.GitRepo(source_path)
else
mkpath(source_path)
Expand Down Expand Up @@ -161,7 +165,11 @@ function fetch(io::IO, repo::LibGit2.GitRepo, remoteurl=nothing; header=nothing,
if use_cli_git()
let remoteurl=remoteurl
cd(LibGit2.path(repo)) do
run(pipeline(`git fetch -q $remoteurl $(only(refspecs))`; stdout=devnull))
try
run(pipeline(`git fetch -q $remoteurl $(only(refspecs))`; stdout=devnull))
catch err
Pkg.Types.pkgerror("Git cli failed to fetch from '$(remoteurl)', error: $err")
end
end
end
else
Expand Down

0 comments on commit dce46c2

Please sign in to comment.