File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -219,7 +219,11 @@ function read_manifest(f_or_io::Union{String, IO})
219
219
rethrow ()
220
220
end
221
221
if Base. is_v1_format_manifest (raw)
222
- raw = convert_v1_format_manifest (raw)
222
+ if isempty (raw) # treat an empty Manifest file as v2 format for convenience
223
+ raw[" manifest_format" ] = " 2.0.0"
224
+ else
225
+ raw = convert_v1_format_manifest (raw)
226
+ end
223
227
end
224
228
return Manifest (raw, f_or_io)
225
229
end
Original file line number Diff line number Diff line change 44
44
end
45
45
end
46
46
47
+ @testset " Empty manifest file is automatically upgraded to v2" begin
48
+ isolate (loaded_depot= true ) do
49
+ io = IOBuffer ()
50
+ d = mktempdir ()
51
+ manifest = joinpath (d, " Manifest.toml" )
52
+ touch (manifest)
53
+ Pkg. activate (d; io= io)
54
+ output = String (take! (io))
55
+ @test occursin (r" Activating.*project at.*" , output)
56
+ env_manifest = Pkg. Types. Context (). env. manifest_file
57
+ @test samefile (env_manifest, manifest)
58
+ # an empty manifest is still technically considered to be v1 manifest
59
+ @test Base. is_v1_format_manifest (Base. parsed_toml (env_manifest))
60
+ @test Pkg. Types. Context (). env. manifest. manifest_format == v " 2.0.0"
61
+
62
+ Pkg. add (" Profile" ; io= io)
63
+ env_manifest = Pkg. Types. Context (). env. manifest_file
64
+ @test samefile (env_manifest, manifest)
65
+ @test Base. is_v1_format_manifest (Base. parsed_toml (env_manifest)) == false
66
+ @test Pkg. Types. Context (). env. manifest. manifest_format == v " 2.0.0"
67
+
68
+ # check that having a Project with deps, and an empty manifest file doesn't error
69
+ rm (manifest)
70
+ touch (manifest)
71
+ Pkg. activate (d; io= io)
72
+ Pkg. add (" Example" ; io= io)
73
+ end
74
+ end
75
+
47
76
@testset " v1.0: activate, change, maintain manifest format" begin
48
77
reference_manifest_isolated_test (" v1.0" , v1 = true ) do env_dir, env_manifest
49
78
io = IOBuffer ()
You can’t perform that action at this time.
0 commit comments