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

Fix crashes when opening Submodules. #209

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

psineur
Copy link

@psineur psineur commented Sep 30, 2012

Subj, [theRepository workingDirectory] was nill &

index = [[PBGitIndex alloc] initWithRepository:theRepository workingDirectory:[NSURL fileURLWithPath:[theRepository workingDirectory]]];

in the PBGitCommitController's -initWithRepository:superController:

…fix crashes in PBGitCommitController.

I had these crashes only when opening Submodules, didn't try to find why though.
@@ -219,6 +219,9 @@ - (id) initWithURL: (NSURL*) path
// We don't want the window controller to display anything yet..
// We'll leave that to the caller of this method.
#ifndef CLI
if (![self workingDirectory]) { // If we couldn't find the working directory, assume it's the place we were opened from.
workingDirectory = [[path absoluteURL] path];
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just copypasted this from line 169 -readFromURL:ofType:error:

@psineur
Copy link
Author

psineur commented Sep 30, 2012

Hah, this made them rare, but still possible to crash.
I've found that i have crash, when opened a submodule.

PBGitRepository than have fileURL like
file://localhost/PATH_TO_REPO/.git/modules/SUBMODULE_FOLDER/PATH/

so there's no "/.git" suffix and "rev-parse --is-inside-work-tree" command returns false.

@psineur
Copy link
Author

psineur commented Sep 30, 2012

Ok, now -workingDirectory can not return nil.
Only if self.fileURL is nil.

@stigi
Copy link

stigi commented Oct 8, 2012

Would love to see a version with this PR merged :shipit:

@psineur
Copy link
Author

psineur commented Oct 9, 2012

If current master branch is unstable, here's this PR applied to 0.8.4 : https://github.com/psineur/gitx/tree/psineur

@dannybabiy
Copy link

Thanks psineur, the patch resolved a crash i was having as well

@jordanandree
Copy link

this resolved the submodule crash for me as well, thanks @psineur

jspiro added a commit to jspiro/gitx that referenced this pull request Nov 26, 2021
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.

4 participants