fix: missing autocmd data when no branch (#137)

main
Anurag 2024-06-16 04:50:38 +08:00 committed by GitHub
parent e50e0b65b0
commit 0a9eebf5cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 4 deletions

View File

@ -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