Skip to content

Fix the context menu doing nothing for staged files - #586

Merged
hannesa2 merged 1 commit into
gitx:masterfrom
goneng:fix-open-files-on-staged-selection
Aug 23, 2026
Merged

hannesa2 merged 1 commit into
gitx:masterfrom
goneng:fix-open-files-on-staged-selection

Conversation

@goneng

@goneng goneng commented Aug 23, 2026 •

Copy link
Copy Markdown
Collaborator

Read the selection from the table whose contextual menu was used, so
the file actions act on the files the menu was opened on.

  • Compare the menu item's menu against the staged table's menu, which
    is the comparison the menu validation already makes
  • Cover the mapping from either table's menu with tests

The controller copies the unstaged table's menu when the view loads so
the two tables can be told apart by identity, and the menu validation
relies on exactly that.
The sender lookup never did, comparing the menu-item itself against a menu,
which is never equal, so every lookup resolved to the unstaged table.

Opening a staged selection from its contextual menu therefore did nothing at all,
while the menu went on offering the item and naming the files correctly, since
the title is built by the validation that gets the comparison right.
Revealing a staged selection in Finder was silently broken the same way.
The two remaining actions that share the lookup, moving to trash and ignoring,
are already hidden or disabled for the staged table, so neither was reachable.

Supporting Images

Context-menu

The option is available for staged files, but does not work

image

Top-menu

The option is grayed-out when staged files are selected

image

Test plan

  • New PBGitCommitFileSelectionTests covers both tables; the staged
    case fails before this change and passes after, and the unstaged
    case passes either way
  • xcodebuild test -only-testing:GitXTests passes 41/41

Read the selection from the table whose contextual menu was used, so
the file actions act on the files the menu was opened on.

- Compare the menu item's menu against the staged table's menu, which
  is the comparison the menu validation already makes
- Cover the mapping from either table's menu with tests

The controller copies the unstaged table's menu when the view loads so
the two tables can be told apart by identity. The sender lookup never
used that, comparing the menu item itself against a menu, which is
never equal, so every lookup resolved to the unstaged table. Opening
and revealing a staged selection therefore did nothing at all, while
the menu went on offering both and naming the files correctly.
@goneng
goneng marked this pull request as ready for review August 23, 2026 12:15
@goneng
goneng marked this pull request as draft August 23, 2026 12:26
@goneng
goneng marked this pull request as ready for review August 23, 2026 12:26
@hannesa2
hannesa2 merged commit c7d5714 into gitx:master Aug 23, 2026
3 checks passed
@goneng
goneng deleted the fix-open-files-on-staged-selection branch August 23, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants