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

Dev #1603

Merged
merged 10 commits into from
Dec 18, 2024
Prev Previous commit
Next Next commit
Clean up tags annotations
  • Loading branch information
CKolkey committed Dec 17, 2024
commit 774db62a74cdd4d09f8a8ea4a2b69d6efee3f8ae
20 changes: 10 additions & 10 deletions lua/neogit/popups/tag/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ local function fire_tag_event(pattern, data)
vim.api.nvim_exec_autocmds("User", { pattern = pattern, modeline = false, data = data })
end

---@param popup PopupData
function M.create_tag(popup)
local tag_input = input.get_user_input("Create tag", { strip_spaces = true })
if not tag_input then
Expand Down Expand Up @@ -48,7 +49,7 @@ function M.create_release(_) end
--- If there are multiple tags then offer to delete those.
--- Otherwise prompt for a single tag to be deleted.
--- git tag -d TAGS
---@param _ table
---@param _ PopupData
function M.delete(_)
local tags = FuzzyFinderBuffer.new(git.tag.list()):open_async { allow_multi = true }
if #(tags or {}) == 0 then
Expand All @@ -64,22 +65,21 @@ function M.delete(_)
end

--- Prunes differing tags from local and remote
---@param _ table
---@param _ PopupData
function M.prune(_)
local tags = git.tag.list()
if #tags == 0 then
notification.info("No tags found")
return
end

local selected_remote = FuzzyFinderBuffer.new(git.remote.list()):open_async {
prompt_prefix = "Prune tags using remote",
}

if (selected_remote or "") == "" then
return
end

local tags = git.tag.list()
if #tags == 0 then
notification.info("No tags found")
return
end

notification.info("Fetching remote tags...")
local r_out = git.tag.list_remote(selected_remote)
local remote_tags = {}
Expand All @@ -96,7 +96,7 @@ function M.prune(_)

notification.delete_all()
if #l_tags == 0 and #r_tags == 0 then
notification.info("Same tags exist locally and remotely")
notification.info("Tags are in sync - nothing to do.")
return
end

Expand Down