File tree Expand file tree Collapse file tree 1 file changed +16
-17
lines changed Expand file tree Collapse file tree 1 file changed +16
-17
lines changed Original file line number Diff line number Diff line change @@ -78,8 +78,6 @@ + (NSURL*)baseDirForURL:(NSURL*)repositoryURL;
78
78
// this works much better.
79
79
- (BOOL )readFromURL : (NSURL *)absoluteURL ofType : (NSString *)typeName error : (NSError **)outError
80
80
{
81
- BOOL success = NO ;
82
-
83
81
if (![PBGitBinary path ])
84
82
{
85
83
if (outError) {
@@ -89,32 +87,33 @@ - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSEr
89
87
}
90
88
return NO ;
91
89
}
92
- BOOL lIsDirectory = FALSE ;
93
- [[NSFileManager defaultManager ] fileExistsAtPath: [absoluteURL path ] isDirectory: &lIsDirectory];
94
- if (!lIsDirectory) {
90
+
91
+ BOOL isDirectory = FALSE ;
92
+ [[NSFileManager defaultManager ] fileExistsAtPath: [absoluteURL path ] isDirectory: &isDirectory];
93
+ if (!isDirectory) {
95
94
if (outError) {
96
95
NSDictionary * userInfo = [NSDictionary dictionaryWithObject: @" Reading files is not supported."
97
96
forKey: NSLocalizedRecoverySuggestionErrorKey ];
98
97
*outError = [NSError errorWithDomain: PBGitRepositoryErrorDomain code: 0 userInfo: userInfo];
99
98
}
100
- } else {
101
- NSURL * gitDirURL = [PBGitRepository gitDirForURL: [self fileURL ]];
102
- if (gitDirURL) {
103
- [self setFileURL: gitDirURL];
104
- success = YES ;
105
- } else if (outError) {
99
+ return NO ;
100
+ }
101
+
102
+
103
+ NSURL * gitDirURL = [PBGitRepository gitDirForURL: [self fileURL ]];
104
+ if (!gitDirURL) {
105
+ if (outError) {
106
106
NSDictionary * userInfo = [NSDictionary dictionaryWithObject: [NSString stringWithFormat: @" %@ does not appear to be a git repository." , [self fileName ]]
107
107
forKey: NSLocalizedRecoverySuggestionErrorKey ];
108
108
*outError = [NSError errorWithDomain: PBGitRepositoryErrorDomain code: 0 userInfo: userInfo];
109
109
}
110
-
111
- if (success) {
112
- [self setup ];
113
- [self readCurrentBranch ];
114
- }
110
+ return NO ;
115
111
}
116
112
117
- return success;
113
+ [self setFileURL: gitDirURL];
114
+ [self setup ];
115
+ [self readCurrentBranch ];
116
+ return YES ;
118
117
}
119
118
120
119
- (void ) setup
You can’t perform that action at this time.
0 commit comments