Merge pull request #21 from juliushaertl/fix/remote-branch-performance
This commit is contained in:
commit
0736a4666e
1 changed files with 7 additions and 1 deletions
|
|
@ -60,7 +60,13 @@ end
|
||||||
|
|
||||||
-- Checks if the supplied branch is available on the remote
|
-- Checks if the supplied branch is available on the remote
|
||||||
function M.is_branch_upstreamed(branch)
|
function M.is_branch_upstreamed(branch)
|
||||||
local output = M.trim(vim.fn.system("git ls-remote --exit-code --heads origin " .. branch))
|
local output = M.trim(vim.fn.system("git branch -r --list origin/" .. branch))
|
||||||
|
if output:find(branch, 1, true) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ls-remote is more expensive so only use it as a fallback
|
||||||
|
output = M.trim(vim.fn.system("git ls-remote --exit-code --heads origin " .. branch))
|
||||||
return output ~= ""
|
return output ~= ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue