From 6a7a10b6117aface6a25b54906140ad4f7fdabfc Mon Sep 17 00:00:00 2001 From: Steven Arcangeli Date: Tue, 23 Apr 2024 19:31:54 -0700 Subject: [PATCH] fix: git mv errors when moving empty directory (#358) --- lua/oil/git.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/oil/git.lua b/lua/oil/git.lua index b01c305..ec3b84b 100644 --- a/lua/oil/git.lua +++ b/lua/oil/git.lua @@ -96,7 +96,10 @@ M.mv = function(entry_type, src_path, dest_path, cb) on_exit = function(_, code) if code ~= 0 then stderr = vim.trim(stderr) - if stderr:match("^fatal: not under version control") then + if + stderr:match("^fatal: not under version control") + or stderr:match("^fatal: source directory is empty") + then fs.recursive_move(entry_type, src_path, dest_path, cb) else cb("Error in git mv: " .. stderr)