test: fix branch test
parent
dafb7a9e43
commit
2379b3dfe8
|
|
@ -54,7 +54,7 @@ end
|
||||||
|
|
||||||
---Get the current Git branch
|
---Get the current Git branch
|
||||||
---@return string
|
---@return string
|
||||||
local function get_branch()
|
function M.get_branch()
|
||||||
vim.fn.system([[git rev-parse 2> /dev/null]])
|
vim.fn.system([[git rev-parse 2> /dev/null]])
|
||||||
local git_enabled = (vim.v.shell_error == 0)
|
local git_enabled = (vim.v.shell_error == 0)
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@ end
|
||||||
---@return string
|
---@return string
|
||||||
local function get_current()
|
local function get_current()
|
||||||
local name = vim.fn.getcwd():gsub(utils.get_dir_pattern(), "%%")
|
local name = vim.fn.getcwd():gsub(utils.get_dir_pattern(), "%%")
|
||||||
return (config.options.dir or config.options.save_dir) .. name .. get_branch() .. ".vim"
|
return (config.options.dir or config.options.save_dir) .. name .. M.get_branch() .. ".vim"
|
||||||
end
|
end
|
||||||
|
|
||||||
---Setup the plugin based on the intersect of the default and the user's config
|
---Setup the plugin based on the intersect of the default and the user's config
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ describe("Git Branching", function()
|
||||||
it("ensures the session has the branch name in", function()
|
it("ensures the session has the branch name in", function()
|
||||||
-- Workout what the name should be
|
-- Workout what the name should be
|
||||||
local pattern = "/"
|
local pattern = "/"
|
||||||
local name = vim.fn.getcwd():gsub(pattern, "%%") .. "_main.vim"
|
local name = vim.fn.getcwd():gsub(pattern, "%%") .. require("persisted").get_branch() .. ".vim"
|
||||||
local session = vim.fn.glob(session_dir .. "*.vim", true, true)[1]
|
local session = vim.fn.glob(session_dir .. "*.vim", true, true)[1]
|
||||||
|
|
||||||
session:gsub(session_dir .. "/", "")
|
session:gsub(session_dir .. "/", "")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue