File tree 3 files changed +22
-0
lines changed
3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,8 @@ function M.setup(opts)
188
188
M .options .lockfile = Util .norm (M .options .lockfile )
189
189
M .options .readme .root = Util .norm (M .options .readme .root )
190
190
191
+ vim .fn .mkdir (M .options .root , " p" )
192
+
191
193
if M .options .performance .reset_packpath then
192
194
vim .go .packpath = vim .env .VIMRUNTIME
193
195
end
Original file line number Diff line number Diff line change @@ -308,14 +308,24 @@ function Spec:merge(old, new)
308
308
end
309
309
310
310
function M .update_state ()
311
+ --- @type string[]
312
+ local cloning = {}
313
+
311
314
--- @type table<string,FileType>
312
315
local installed = {}
313
316
Util .ls (Config .options .root , function (_ , name , type )
314
317
if type == " directory" and name ~= " readme" then
315
318
installed [name ] = type
319
+ elseif type == " file" and name :sub (- 8 ) == " .cloning" then
320
+ name = name :sub (1 , - 9 )
321
+ cloning [# cloning + 1 ] = name
316
322
end
317
323
end )
318
324
325
+ for _ , failed in ipairs (cloning ) do
326
+ installed [failed ] = nil
327
+ end
328
+
319
329
for _ , plugin in pairs (Config .plugins ) do
320
330
plugin ._ = plugin ._ or {}
321
331
if plugin .lazy == nil then
Original file line number Diff line number Diff line change 1
1
local Git = require (" lazy.manage.git" )
2
2
local Lock = require (" lazy.manage.lock" )
3
3
local Config = require (" lazy.core.config" )
4
+ local Util = require (" lazy.util" )
4
5
5
6
--- @type table<string , LazyTaskDef>
6
7
local M = {}
@@ -81,13 +82,22 @@ M.clone = {
81
82
end
82
83
83
84
table.insert (args , self .plugin .dir )
85
+
86
+ if vim .fn .isdirectory (self .plugin .dir ) == 1 then
87
+ require (" lazy.manage.task.fs" ).clean .run (self , {})
88
+ end
89
+
90
+ local marker = self .plugin .dir .. " .cloning"
91
+ Util .write_file (marker , " " )
92
+
84
93
self :spawn (" git" , {
85
94
args = args ,
86
95
on_exit = function (ok )
87
96
if ok then
88
97
self .plugin ._ .cloned = true
89
98
self .plugin ._ .installed = true
90
99
self .plugin ._ .dirty = true
100
+ vim .loop .fs_unlink (marker )
91
101
end
92
102
end ,
93
103
})
You can’t perform that action at this time.
0 commit comments