diff --git a/src/Tar.jl b/src/Tar.jl index 0e3efed..8e3364d 100644 --- a/src/Tar.jl +++ b/src/Tar.jl @@ -246,23 +246,19 @@ function extract( predicate === true_predicate || skeleton === nothing || error("extract: predicate and skeleton cannot be used together") skeleton = something(skeleton, devnull) - dir isa AbstractString && (dir = String(dir)) + dir_str = dir isa AbstractString ? String(dir) : dir check_extract_tarball(tarball) - check_extract_dir(dir) + check_extract_dir(dir_str) arg_read(tarball) do tar - arg_mkdir(dir) do dir - if copy_symlinks === nothing - copy_symlinks = !can_symlink(dir) - end - let copy_symlinks=copy_symlinks - arg_write(skeleton) do skeleton - extract_tarball( - predicate, tar, dir, - skeleton = skeleton, - copy_symlinks = copy_symlinks, - set_permissions = set_permissions, - ) - end + arg_mkdir(dir_str) do dir + copy_symlinks_local = copy_symlinks === nothing ? !can_symlink(dir) : copy_symlinks + arg_write(skeleton) do skeleton + extract_tarball( + predicate, tar, dir, + skeleton = skeleton, + copy_symlinks = copy_symlinks_local, + set_permissions = set_permissions, + ) end end end diff --git a/src/extract.jl b/src/extract.jl index 325268b..a8346d1 100644 --- a/src/extract.jl +++ b/src/extract.jl @@ -289,9 +289,9 @@ function hash_git_tree(node::GitTree, ::Type{HashType}) where HashType <: SHA.SH by((name, child)) = child isa GitTree ? "$name/" : name hash = git_object_hash("tree", HashType) do io for (name, child) in sort!(collect(node.children), by=by) - mode, hash = hash_git_tree(child, HashType) + mode, child_hash = hash_git_tree(child, HashType) print(io, mode, ' ', name, '\0') - write(io, hex2bytes(hash)) + write(io, hex2bytes(child_hash)) end end return ("40000", hash)