Skip to content

Add "Push Current Commit Tags" action to Remotes menu - #2808

Open
NikKovIos wants to merge 2 commits into
git-up:masterfrom
NikKovIos:feature/push-current-commit-tags
Open

Add "Push Current Commit Tags" action to Remotes menu#2808
NikKovIos wants to merge 2 commits into
git-up:masterfrom
NikKovIos:feature/push-current-commit-tags

Conversation

@NikKovIos

Copy link
Copy Markdown
Contributor

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.

  • Current commit is resolved as the commit selected in the graph, or HEAD when nothing is selected — mirroring the "current" semantics of the neighbouring Push Current Branch item.
  • Tags are force-pushed, consistent with GitUp's existing tag-push behavior (_pushTag:toRemote: / pushAllTagsToAllRemotes), and pushed to all remotes by looping over listRemotes: inside a single background operation, following the existing deleteTagFromAllRemotes: pattern.
  • The menu item is disabled when the current commit has no tags.
  • A single confirmation dialog (suppressible via the shared 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 on deleteTagFromAllRemotes: and pushAllTagsToAllRemotes.
  • GIMapViewController.{h,m} — new -pushCurrentCommitTags: IBAction and a validation branch in validateUserInterfaceItem: (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 ⌃⇧⌘T key equivalent (no conflict: ⇧⌘T = Fetch All Tags, ⌥⌘T = Fetch and Prune).

Testing

  • Builds cleanly (Application scheme, Debug); the item, title and selector are present in the compiled MainMenu.nib.
  • Note: exercising the actual network push requires a configured remote with credentials.

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.
Comment thread GitUpKit/Views/GIMapViewController+Operations.h
Comment thread GitUpKit/Views/GIMapViewController+Operations.m Outdated
@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds a Remotes → Push Current Commit Tags menu item (⌃⇧⌘T) that force-pushes all tags on the selected (or HEAD) commit to every configured remote. The implementation closely mirrors the existing deleteTagFromAllRemotes: and pushTag:toRemote: patterns: a confirmation dialog (with its own suppression key kUserDefaultsKey_SkipPushCurrentCommitTagsWarning) → main-thread listRemotes: → background loop over remotes × tags → success/error overlay.

  • GIMapViewController+Operations.m adds pushTagsToAllRemotes:, fetches remotes inside the confirmation block, and runs the push loop in a background operation consistent with existing all-remote operations.
  • GIMapViewController.m adds the IBAction and a validateUserInterfaceItem: branch placed before the selected-commit guard so it works when no commit is selected (falls back to HEAD).
  • MainMenu.xib wires the new menu item to First Responder with ⌃⇧⌘T (no conflict with existing bindings).

Confidence Score: 5/5

Safe to merge — the new action correctly follows the established all-remotes background-loop pattern with a distinct suppression key and proper enable/disable validation.

The implementation is a faithful application of existing patterns: confirmation dialog with its own suppression key, main-thread remote enumeration, background-threaded push loop with early-exit on error, and a success/error overlay. Edge cases (no selection, unborn HEAD, empty tag list, no remotes, remote list error) are all handled correctly through nil-messaging safety and explicit guards. The only finding is a minor alert-type inconsistency that does not affect correctness.

Files Needing Attention: No files require special attention.

Important Files Changed

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
Loading

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant