From 284d714b8da98508d117ee1c3a92cbdf6c6fac87 Mon Sep 17 00:00:00 2001 From: olimorris Date: Fri, 5 Jan 2024 22:56:04 +0000 Subject: [PATCH] fix: #107 corrected remove warning message --- lua/persisted/init.lua | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lua/persisted/init.lua b/lua/persisted/init.lua index cb9f1b5..17abdb5 100644 --- a/lua/persisted/init.lua +++ b/lua/persisted/init.lua @@ -113,6 +113,15 @@ function M.get_branch(dir) if vim.fn.filereadable(branch_session) ~= 0 then return branch else + vim.api.nvim_echo({ + { "[Persisted.nvim]\n", "Question" }, + { "Could not load a session for branch " }, + { git_branch[1] .. "\n", "WarningMsg" }, + { "Trying to load a session for branch " }, + { config.options.default_branch, "Title" }, + { " ..." }, + }, true, {}) + vim.g.persisted_branch_session = branch_session return config.options.branch_separator .. config.options.default_branch end @@ -177,17 +186,6 @@ function M.load(opt, dir) end end - if session and not session_exists then - vim.api.nvim_echo({ - { "[Persisted.nvim]\n", "Question" }, - { "Could not find a session for " }, - { vim.fn.getcwd() .. "\n", "WarningMsg" }, - { "As per " }, - { "https://github.com/olimorris/persisted.nvim/discussions/103", "WarningMsg" }, - { " you may need to remove the branch from the name" }, - }, true, {}) - end - if config.options.autosave and (allow_dir(dir) and not ignore_dir(dir)) then M.start() end