Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update the implementation method of obtaining the git root direc… #146

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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