Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Artifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,14 @@ function _mv_temp_artifact_dir(temp_dir::String, new_path::String)::Nothing
err = ccall(:jl_fs_rename, Int32, (Cstring, Cstring), temp_dir, new_path)
if err ≥ 0
# rename worked
chmod(new_path, filemode(dirname(new_path)))
new_path_mode = filemode(dirname(new_path))
if Sys.iswindows()
# If this is Windows, ensure the directory mode is executable,
# as `filemode()` is incomplete. Some day, that may not be the
# case, there exists a test that will fail if this is changes.
new_path_mode |= 0o111
end
chmod(new_path, new_path_mode)
set_readonly(new_path)
return
else
Expand Down
20 changes: 10 additions & 10 deletions src/GitTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,6 @@ function clone(io::IO, url, source_path; header=nothing, credentials=nothing, kw
printpkgstyle(io, :Cloning, header === nothing ? "git-repo `$url`" : header)
bar = MiniProgressBar(header = "Fetching:", color = Base.info_color())
fancyprint = can_fancyprint(io)
callbacks = if fancyprint
LibGit2.Callbacks(
:transfer_progress => (
@cfunction(transfer_progress, Cint, (Ptr{LibGit2.TransferProgress}, Any)),
bar,
)
)
else
LibGit2.Callbacks()
end
fancyprint && start_progress(io, bar)
if credentials === nothing
credentials = LibGit2.CachedCredentials()
Expand All @@ -121,6 +111,16 @@ function clone(io::IO, url, source_path; header=nothing, credentials=nothing, kw
end
return LibGit2.GitRepo(source_path)
else
callbacks = if fancyprint
LibGit2.Callbacks(
:transfer_progress => (
@cfunction(transfer_progress, Cint, (Ptr{LibGit2.TransferProgress}, Any)),
bar,
)
)
else
LibGit2.Callbacks()
end
mkpath(source_path)
return LibGit2.clone(url, source_path; callbacks=callbacks, credentials=credentials, kwargs...)
end
Expand Down
11 changes: 7 additions & 4 deletions src/utils.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# "Precompiling" is the longest operation
const pkgstyle_indent = textwidth(string(:Precompiling))

function printpkgstyle(io::IO, cmd::Symbol, text::String, ignore_indent::Bool=false; color=:green)
indent = textwidth(string(:Precompiling)) # "Precompiling" is the longest operation
ignore_indent && (indent = 0)
printstyled(io, lpad(string(cmd), indent), color=color, bold=true)
println(io, " ", text)
indent = ignore_indent ? 0 : pkgstyle_indent
@lock io begin
printstyled(io, lpad(string(cmd), indent), color=color, bold=true)
println(io, " ", text)
end
end

function linewrap(str::String; io = stdout_f(), padding = 0, width = Base.displaysize(io)[2])
Expand Down
12 changes: 12 additions & 0 deletions test/artifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -825,4 +825,16 @@ end
end
end

if Sys.iswindows()
@testset "filemode(dir) non-executable on windows" begin
mktempdir() do dir
touch(joinpath(dir, "foo"))
@test !isempty(readdir(dir))
# This technically should be true, the fact that it's not is
# a wrinkle of libuv, it would be nice to fix it and so if we
# do, this test will let us know.
@test filemode(dir) & 0o001 == 0
end
end
end
end # module
Loading