Skip to content

Commit 284d714

Browse files
committed
fix: #107 corrected remove warning message
1 parent 9545fc0 commit 284d714

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

lua/persisted/init.lua

+9-11
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ function M.get_branch(dir)
113113
if vim.fn.filereadable(branch_session) ~= 0 then
114114
return branch
115115
else
116+
vim.api.nvim_echo({
117+
{ "[Persisted.nvim]\n", "Question" },
118+
{ "Could not load a session for branch " },
119+
{ git_branch[1] .. "\n", "WarningMsg" },
120+
{ "Trying to load a session for branch " },
121+
{ config.options.default_branch, "Title" },
122+
{ " ..." },
123+
}, true, {})
124+
116125
vim.g.persisted_branch_session = branch_session
117126
return config.options.branch_separator .. config.options.default_branch
118127
end
@@ -177,17 +186,6 @@ function M.load(opt, dir)
177186
end
178187
end
179188

180-
if session and not session_exists then
181-
vim.api.nvim_echo({
182-
{ "[Persisted.nvim]\n", "Question" },
183-
{ "Could not find a session for " },
184-
{ vim.fn.getcwd() .. "\n", "WarningMsg" },
185-
{ "As per " },
186-
{ "https://github.com/olimorris/persisted.nvim/discussions/103", "WarningMsg" },
187-
{ " you may need to remove the branch from the name" },
188-
}, true, {})
189-
end
190-
191189
if config.options.autosave and (allow_dir(dir) and not ignore_dir(dir)) then
192190
M.start()
193191
end

0 commit comments

Comments
 (0)