|
22 | 22 | withtempdir() do tmp_dir
|
23 | 23 | @test !isdir("Git.jl")
|
24 | 24 | @test !isfile(joinpath("Git.jl", "Project.toml"))
|
25 |
| - run(`$(git()) clone https://github.com/JuliaVersionControl/Git.jl`) |
| 25 | + run(`$(git()) clone --quiet https://github.com/JuliaVersionControl/Git.jl`) |
26 | 26 | @test isdir("Git.jl")
|
27 | 27 | @test isfile(joinpath("Git.jl", "Project.toml"))
|
28 | 28 | end
|
29 | 29 |
|
30 | 30 | withtempdir() do tmp_dir
|
31 | 31 | @test !isdir("Git.jl")
|
32 | 32 | @test !isfile(joinpath("Git.jl", "Project.toml"))
|
33 |
| - run(git(["clone", "https://github.com/JuliaVersionControl/Git.jl"])) |
| 33 | + run(git(["clone", "--quiet", "https://github.com/JuliaVersionControl/Git.jl"])) |
34 | 34 | @test isdir("Git.jl")
|
35 | 35 | @test isfile(joinpath("Git.jl", "Project.toml"))
|
36 | 36 | end
|
|
43 | 43 | @test orig_cainfo == get_env("GIT_SSL_CAINFO")
|
44 | 44 | @test orig_templatedir == get_env("GIT_TEMPLATE_DIR")
|
45 | 45 | end
|
| 46 | + |
| 47 | +# This makes sure the work around for the SIP restrictions on macOS |
| 48 | +# (<https://github.com/JuliaVersionControl/Git.jl/issues/40>) works correctly. While SIP is |
| 49 | +# a macOS-specific issue, it's good to exercise this code path everywhere. |
| 50 | +@testset "SIP workaround" begin |
| 51 | + gitd(dir, cmd; stdout=Base.stdout, stderr=Base.stderr) = |
| 52 | + success(pipeline(`$(git()) -C $(dir) -c "user.name=a" -c "user.email=b@c" $(cmd)`; |
| 53 | + stdout, stderr)) |
| 54 | + branch = "dev" |
| 55 | + mktempdir() do dir1; mktempdir() do dir2; |
| 56 | + @test gitd(dir1, `init --bare --quiet --initial-branch $(branch)`) |
| 57 | + @test gitd(dir2, `init --quiet --initial-branch $(branch)`) |
| 58 | + open(joinpath(dir2, "README"); write=true) do io |
| 59 | + println(io, "test") |
| 60 | + end |
| 61 | + @test gitd(dir2, `add --all`) |
| 62 | + @test gitd(dir2, `commit --quiet -m test`) |
| 63 | + @test gitd(dir2, `remote add origin file://$(dir1)`) |
| 64 | + @test gitd(dir2, `push --quiet --set-upstream origin $(branch)`) |
| 65 | + dir1_io, dir2_io = IOBuffer(), IOBuffer() |
| 66 | + @test gitd(dir1, `log`; stdout=dir1_io) |
| 67 | + @test gitd(dir2, `log`; stdout=dir2_io) |
| 68 | + # Make sure the logs are the same for the two repositories |
| 69 | + dir1_log, dir2_log = String.(take!.((dir1_io, dir2_io))) |
| 70 | + @test !isempty(dir1_log) === !isempty(dir2_log) === true |
| 71 | + @test dir1_log == dir2_log |
| 72 | + end; end |
| 73 | +end |
0 commit comments