Repository navigation
Fix GitX quitting when a commit is clicked in a missing repository - #653
Merged
Merged
Conversation
GitX quits, with no error and no warning, when a commit is clicked in a repository that is no longer where GitX left it: the folder deleted or renamed, or the drive it sat on ejected. Showing a commit the details pane has not shown before puts the name of the current branch into the argument list the page is called with, and that name is nothing at all once HEAD can no longer be read. A nil in an array literal raises, and nothing catches it, so the window goes rather than going blank. * Answer the current branch name in one place, so a repository with no readable HEAD names no branch rather than nothing at all * Have both the first load and the in place refresh ask for it there, the refresh having been the only one of the two that guarded itself
goneng
force-pushed
the
fix-details-pane-abort-without-head
branch
from
September 15, 2026 18:39
9b4d3c0 to
ece6ee8
Compare
goneng
marked this pull request as ready for review
September 15, 2026 18:41
hannesa2
approved these changes
Sep 15, 2026
|
|
||
| // The name goes straight into the argument list the page is called with, and a | ||
| // nil there aborts the application rather than leaving the pane blank. | ||
| - (void)testTheArgumentsForACommitCanBeBuiltWhenHeadCannotBeRead |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitX quits, with no error and no warning, when you click a commit in a repository that is no longer where GitX left it: the folder was deleted or renamed, or it lived on a drive that has since been ejected. The window is simply gone.
Fixes #648.
Showing a commit the details pane has not shown before passes the current branch
name into the argument list the page is called with:
That name is nil in two independent ways.
-headRefreturns nil when the HEADlookup fails, when resolving it fails on a HEAD that is not unborn, or when the
resolved reference has no name;
-simpleRefreturns nil separately when thespecifier is not a simple ref. A nil in an array literal raises, so instead of
the pane going blank the application goes away.
The same expression appeared twice, and only the in place refresh guarded
itself, so the fix is one answer both callers share rather than a second guard
that the next caller could forget.
Test plan
[[PBGitRepository alloc] init]gives and needs neither libgit2 nor arepository on disk
NSInvalidArgumentException: attempt to insert nil object from objects[1]Not reproduced end to end, since it needs a repository that opened normally and
then stopped being readable. The tests pin the condition instead.