Skip to content

Commit 6f89667

Browse files
KristofferCKristofferC
andcommitted
also use a bare repo when cloning for add using cli GIT (#4296)
Co-authored-by: KristofferC <[email protected]> (cherry picked from commit d0c6d50)
1 parent 6ae29ed commit 6f89667

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/GitTools.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function checkout_tree_to_path(repo::LibGit2.GitRepo, tree::LibGit2.GitObject, p
8989
end
9090
end
9191

92-
function clone(io::IO, url, source_path; header=nothing, credentials=nothing, kwargs...)
92+
function clone(io::IO, url, source_path; header=nothing, credentials=nothing, isbare=false, kwargs...)
9393
url = String(url)::String
9494
source_path = String(source_path)::String
9595
@assert !isdir(source_path) || isempty(readdir(source_path))
@@ -103,7 +103,9 @@ function clone(io::IO, url, source_path; header=nothing, credentials=nothing, kw
103103
end
104104
try
105105
if use_cli_git()
106-
cmd = `git clone --quiet $url $source_path`
106+
args = ["--quiet", url, source_path]
107+
isbare && pushfirst!(args, "--bare")
108+
cmd = `git clone $args`
107109
try
108110
run(pipeline(cmd; stdout=devnull))
109111
catch err
@@ -122,7 +124,7 @@ function clone(io::IO, url, source_path; header=nothing, credentials=nothing, kw
122124
LibGit2.Callbacks()
123125
end
124126
mkpath(source_path)
125-
return LibGit2.clone(url, source_path; callbacks, credentials, kwargs...)
127+
return LibGit2.clone(url, source_path; callbacks, credentials, isbare, kwargs...)
126128
end
127129
catch err
128130
rm(source_path; force=true, recursive=true)
@@ -151,7 +153,6 @@ function fetch(io::IO, repo::LibGit2.GitRepo, remoteurl=nothing; header=nothing,
151153
remoteurl = normalize_url(remoteurl)
152154
printpkgstyle(io, :Updating, header === nothing ? "git-repo `$remoteurl`" : header)
153155
bar = MiniProgressBar(header = "Fetching:", color = Base.info_color())
154-
fancyprint = can_fancyprint(io)
155156
callbacks = if fancyprint
156157
LibGit2.Callbacks(
157158
:transfer_progress => (

0 commit comments

Comments
 (0)