Add "Push Current Commit Tags" action to Remotes menu - #2808
Conversation
Adds a Remotes menu item (Cmd+Shift+Ctrl+T) that pushes the tags pointing at the current commit to all remotes. The current commit is the commit selected in the graph, or HEAD when nothing is selected. Tags are force-pushed, consistent with the existing tag push behavior in GitUp. The menu item is disabled when the current commit has no tags.
|
| Filename | Overview |
|---|---|
| GitUpKit/Views/GIMapViewController+Operations.m | Adds pushTagsToAllRemotes: implementing force-push of commit tags to all remotes; uses a distinct suppression key and follows the deleteTagFromAllRemotes: background-loop pattern, but uses kGIAlertType_Caution where other all-remotes operations use _AlertTypeForDangerousRemoteOperations(). |
| GitUpKit/Views/GIMapViewController.m | Adds pushCurrentCommitTags: IBAction and the corresponding validateUserInterfaceItem: branch; correctly placed before the selected-commit guard so it works on HEAD when nothing is selected. |
| GitUpKit/Views/GIMapViewController+Operations.h | Declares pushTagsToAllRemotes: with an untyped NSArray* parameter; every adjacent method in this file uses Objective-C lightweight generics (GCHistoryTag*, etc.). |
| GitUpKit/Views/GIMapViewController.h | Adds pushCurrentCommitTags: IBAction declaration; straightforward one-liner addition consistent with adjacent declarations. |
| GitUp/Application/Base.lproj/MainMenu.xib | Adds the new menu item under Remotes with ⌃⇧⌘T shortcut wired to pushCurrentCommitTags: on First Responder; shortcut does not conflict with existing bindings (⇧⌘T / ⌥⌘T). |
Sequence Diagram
sequenceDiagram
participant User
participant Menu as MainMenu
participant MVC as GIMapViewController
participant Ops as GIMapViewController+Operations
participant Repo as GCRepository
participant Remote as GCRemote(s)
User->>Menu: Click Push Current Commit Tags
Menu->>MVC: validateUserInterfaceItem:
MVC->>MVC: selectedCommit ?: HEADCommit
MVC-->>Menu: "enabled if commit.tags.count > 0"
User->>MVC: pushCurrentCommitTags:
MVC->>MVC: selectedCommit ?: HEADCommit
MVC->>Ops: pushTagsToAllRemotes:(commit.tags)
Ops->>User: confirmUserActionWithAlertType
User-->>Ops: Confirm
Ops->>Repo: listRemotes:
Repo-->>Ops: NSArray of GCRemote
Ops->>Repo: performOperationInBackground
loop for each remote x tag
Repo->>Remote: pushTag toRemote force YES
Remote-->>Repo: success or error
end
Repo-->>Ops: completionBlock(success, error)
alt success
Ops->>User: showOverlay tags pushed successfully
else error
Ops->>User: presentError
end
Reviews (2): Last reviewed commit: "Use a dedicated suppression key for push..." | Re-trigger Greptile
Pushing the current commit tags force-pushes to every remote, which has a larger blast radius than the single-tag-to-single-remote push that owns kUserDefaultsKey_SkipPushTagWarning. Sharing the key meant suppressing the narrower dialog would silently skip confirmation for the broader action.
Summary
Adds a new Remotes → Push Current Commit Tags menu item (shortcut ⌃⇧⌘T,
Cmd+Shift+Ctrl+T) that pushes the tags pointing at the current commit to all remotes.HEADwhen nothing is selected — mirroring the "current" semantics of the neighbouring Push Current Branch item._pushTag:toRemote:/pushAllTagsToAllRemotes), and pushed to all remotes by looping overlistRemotes:inside a single background operation, following the existingdeleteTagFromAllRemotes:pattern.kUserDefaultsKey_SkipPushTagWarning) lists the tags before pushing, and a success/error overlay is shown on completion.Implementation
GIMapViewController+Operations.{h,m}— new-pushTagsToAllRemotes:operation (confirm → background loop over remotes × tags → overlay), modeled ondeleteTagFromAllRemotes:andpushAllTagsToAllRemotes.GIMapViewController.{h,m}— new-pushCurrentCommitTags:IBAction and a validation branch invalidateUserInterfaceItem:(placed before the selected-commit guard so it works without a graph selection).MainMenu.xib— new menu item under Remotes, wired to First Responder with the⌃⇧⌘Tkey equivalent (no conflict:⇧⌘T= Fetch All Tags,⌥⌘T= Fetch and Prune).Testing
Applicationscheme, Debug); the item, title and selector are present in the compiledMainMenu.nib.