fix: duplicate create actions (#334)
This commit is contained in:
parent
c86e48407b
commit
354c53080a
1 changed files with 15 additions and 0 deletions
|
|
@ -61,10 +61,25 @@ M.create_actions_from_diffs = function(all_diffs)
|
|||
return list
|
||||
end,
|
||||
})
|
||||
|
||||
-- To deduplicate create actions
|
||||
-- This can happen when creating deep nested files e.g.
|
||||
-- > foo/bar/a.txt
|
||||
-- > foo/bar/b.txt
|
||||
local seen_creates = {}
|
||||
|
||||
---@param action oil.Action
|
||||
local function add_action(action)
|
||||
local adapter = assert(config.get_adapter_by_scheme(action.dest_url or action.url))
|
||||
if not adapter.filter_action or adapter.filter_action(action) then
|
||||
if action.type == "create" then
|
||||
if seen_creates[action.url] then
|
||||
return
|
||||
else
|
||||
seen_creates[action.url] = true
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(actions, action)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue