[vim] Handle a nil result from io.popen when looking up a Git repo
This commit is contained in:
parent
0accf738ed
commit
8ab6b1ea99
1 changed files with 5 additions and 0 deletions
|
@ -4,8 +4,13 @@ require "os"
|
|||
|
||||
function gitTopLevelDirectory()
|
||||
local handle = io.popen("git rev-parse --show-toplevel")
|
||||
if handle == nil then
|
||||
return nil
|
||||
end
|
||||
|
||||
local gitRepoTopLevelDirectoryPath = vim.fn.trim(handle:read("*a"))
|
||||
handle:close()
|
||||
|
||||
return gitRepoTopLevelDirectoryPath
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue