Skip to content

Commit

Permalink
perf: use vim.fs.basename instead of shell basename (#10)
Browse files Browse the repository at this point in the history
- also will not work on some windows systems who do not have something like wsl setup
- instead grab git full path and use lua to parse the basename
  • Loading branch information
GitMurf authored May 26, 2024
1 parent 0c06ade commit 9685127
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/gitpad/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ function M.init_gitpad_file(opts)
end

-- create the repository directory if it doesn't exist
local repository_name = vim.fn.systemlist("bash -c 'basename `git rev-parse --show-toplevel`'")[1]
local repository_path = vim.fn.systemlist('git rev-parse --show-toplevel')[1]
local repository_name = vim.fs.basename(repository_path)
local notes_dir = vim.fs.normalize(M.config.dir .. '/' .. repository_name)

-- create the notes directory if it doesn't exist
Expand Down

0 comments on commit 9685127

Please sign in to comment.