Small bug fixes (#298)

fix: List remote branches for merge targets (#293)
fix: consider remote branches (#297)
fix: Save popup contents to temp_registers (#294) 

This is a #PATCH release.
This commit is contained in:
Harrison (Harry) Cramer
2024-05-05 11:12:39 -04:00
committed by GitHub
parent 0d0ed1639a
commit 816b87cf91
5 changed files with 21 additions and 14 deletions

View File

@@ -6,6 +6,7 @@ local M = {}
---@param command table
---@return string|nil, string|nil
local run_system = function(command)
-- Load here to prevent loop
local u = require("gitlab.utils")
local result = vim.fn.trim(vim.fn.system(command))
if vim.v.shell_error ~= 0 then
@@ -16,9 +17,12 @@ local run_system = function(command)
end
---Returns all branches for the current repository
---@param args table|nil extra arguments for `git branch`
---@return string|nil, string|nil
M.branches = function()
return run_system({ "git", "branch" })
M.branches = function(args)
-- Load here to prevent loop
local u = require("gitlab.utils")
return run_system(u.combine({ "git", "branch" }, args or {}))
end
---Checks whether the tree has any changes that haven't been pushed to the remote
@@ -60,7 +64,7 @@ end
---Return the list of names of all remote-tracking branches or an empty list.
---@return table, string|nil
M.get_all_remote_branches = function()
local all_branches, err = M.branches()
local all_branches, err = M.branches({ "--remotes" })
if err ~= nil then
return {}, err
end