From 0a9eebf5cc92b1113a382a660ee73f21ffd62ae7 Mon Sep 17 00:00:00 2001 From: Anurag Date: Sun, 16 Jun 2024 04:50:38 +0800 Subject: [PATCH] fix: missing autocmd data when no branch (#137) --- lua/persisted/utils.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/persisted/utils.lua b/lua/persisted/utils.lua index 58dbb07..c89ced8 100644 --- a/lua/persisted/utils.lua +++ b/lua/persisted/utils.lua @@ -37,12 +37,11 @@ function M.make_session_data(session) -- Split the session string into path and branch parts local separator_index = session:find(config.branch_separator) - if not separator_index then - return nil + local branch = "" + if separator_index then + branch = session:sub(separator_index + 2):gsub("%.vim$", ""):gsub("%%", "/") end - local branch = session:sub(separator_index + 2):gsub("%.vim$", ""):gsub("%%", "/") - -- Removing the home directory from the path and cleaning leading `/` local name = session:gsub(config.save_dir, ""):gsub("%%", "/"):gsub(home, "") -- Remove the .vim extension