From 2379b3dfe8c130039e3994acbefba3f3fe5a6972 Mon Sep 17 00:00:00 2001 From: olimorris Date: Mon, 22 Aug 2022 21:33:16 +0100 Subject: [PATCH] test: fix branch test --- lua/persisted/init.lua | 4 ++-- tests/git_branching/git_branching_spec.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/persisted/init.lua b/lua/persisted/init.lua index 80e27fe..c7ceafc 100644 --- a/lua/persisted/init.lua +++ b/lua/persisted/init.lua @@ -54,7 +54,7 @@ end ---Get the current Git branch ---@return string -local function get_branch() +function M.get_branch() vim.fn.system([[git rev-parse 2> /dev/null]]) local git_enabled = (vim.v.shell_error == 0) @@ -72,7 +72,7 @@ end ---@return string local function get_current() 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 ---Setup the plugin based on the intersect of the default and the user's config diff --git a/tests/git_branching/git_branching_spec.lua b/tests/git_branching/git_branching_spec.lua index 9009cf9..3a68c12 100644 --- a/tests/git_branching/git_branching_spec.lua +++ b/tests/git_branching/git_branching_spec.lua @@ -23,7 +23,7 @@ describe("Git Branching", function() it("ensures the session has the branch name in", function() -- Workout what the name should be 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] session:gsub(session_dir .. "/", "")