From 5a8ddeb096982acc4e14228f1bcea25ffb9a6061 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Sat, 1 Nov 2008 16:16:57 +0100 Subject: [PATCH] GitBinary: Show an error if someone entered an invalid git binary --- PBGitBinary.m | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/PBGitBinary.m b/PBGitBinary.m index b8c72e1..49ef7b7 100644 --- a/PBGitBinary.m +++ b/PBGitBinary.m @@ -52,8 +52,17 @@ static NSString* gitPath = nil; // Check what we might have in user defaults // NOTE: Currently this should NOT have a registered default, or the searching bits below won't work gitPath = [[NSUserDefaults standardUserDefaults] stringForKey:@"gitExecutable"]; - if (gitPath.length > 0) - return; + if (gitPath.length > 0) { + if ([self acceptBinary:gitPath]) + return; + [[NSAlert alertWithMessageText:@"Invalid git path" + defaultButton:@"OK" + alternateButton:nil + otherButton:nil + informativeTextWithFormat:@"You entered a custom git path in the Preferences pane, " + "but this path is not a valid git v1.5.4 or higher binary. We're going to use the default " + "search paths instead"] runModal]; + } // Try to find the path of the Git binary char* path = getenv("GIT_PATH");