Skip to content

Commit

Permalink
fix: update the implementation method of obtaining the git root direc… (
Browse files Browse the repository at this point in the history
#146)

Co-authored-by: xiwang <bytedaring@gmail.com>
  • Loading branch information
bytedaring and xiwang committed Mar 28, 2024
1 parent 8a3de4f commit c16f7f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Add the following configuration to your Neovim setup with [lazy.nvim](https://gi
"jellydn/hurl.nvim",
dependencies = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter"
},
ft = "hurl",
Expand Down
6 changes: 4 additions & 2 deletions lua/hurl/git_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ end
--- Get the git root directory
---@return string|nil The git root directory
local function get_git_root()
local dot_git_path = vim.fn.finddir('.git', '.;')
return vim.fn.fnamemodify(dot_git_path, ':h')
local git_root_path = require('plenary.job')
:new({ command = 'git', args = { 'rev-parse', '--show-toplevel' } })
:sync()[1]
return git_root_path
end

local function split_path(path)
Expand Down

0 comments on commit c16f7f6

Please sign in to comment.