Skip to content

Commit b9196af

Browse files
committed
Read path from git_cmd, not global
The path can be modified by preceding code, so we need to read it from `git_cmd`, append the `git-lfs` directory, then write back to `git_cmd`.
1 parent 8f66ab0 commit b9196af

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/git_function.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ function git(; adjust_PATH::Bool = true, adjust_LIBPATH::Bool = true)
5353
end
5454

5555
# Use OpenSSH from the JLL: <https://github.com/JuliaVersionControl/Git.jl/issues/51>.
56-
path = split(get(ENV, "PATH", ""), pathsep)
5756
if !Sys.iswindows() && OpenSSH_jll.is_available()
57+
path = split(get(ENV, "PATH", ""), pathsep)
5858
libpath = split(get(ENV, LIBPATH_env, ""), pathsep)
5959

6060
path = vcat(dirname(OpenSSH_jll.ssh_path), path)
@@ -70,6 +70,14 @@ function git(; adjust_PATH::Bool = true, adjust_LIBPATH::Bool = true)
7070

7171
# Add git-lfs
7272
if Git_LFS_jll.is_available()
73+
# Read path from git_cmd.env as it can be modified above
74+
idx = findfirst(startswith("PATH="), git_cmd.env)
75+
path = if isnothing(idx)
76+
""
77+
else
78+
# dropping the `PATH=` part
79+
git_cmd.env[idx][6:end]
80+
end
7381
path = vcat(dirname(Git_LFS_jll.git_lfs_path), path)
7482
git_cmd = addenv(git_cmd, "PATH" => join(path, pathsep))
7583
end

0 commit comments

Comments
 (0)