Skip to content

Commit 6228da7

Browse files
committed
Merge remote-tracking branch 'upstream/master' into git-notes
2 parents 6e96e11 + 3480278 commit 6228da7

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

ObjectiveGit/GTCredential.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN
4646
/// type - the credential types allowed by the operation.
4747
/// URL - the URL the operation is authenticating against.
4848
/// userName - the user name provided by the operation. Can be nil, and might be ignored.
49-
- (GTCredential * _Nullable)credentialForType:(GTCredentialType)type URL:(NSString *)URL userName:(nullable NSString *)userName;
49+
- (GTCredential * _Nullable)credentialForType:(GTCredentialType)type URL:(nullable NSString *)URL userName:(nullable NSString *)userName;
5050
@end
5151

5252
/// The GTCredential class is used to provide authentication data.

ObjectiveGit/GTOID.m

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@ - (const git_oid *)git_oid {
2727
}
2828

2929
- (NSString *)SHA {
30-
char *SHA = malloc(GIT_OID_HEXSZ);
31-
if (SHA == NULL) return nil;
32-
33-
git_oid_fmt(SHA, self.git_oid);
34-
35-
NSString *str = [[NSString alloc] initWithBytesNoCopy:SHA length:GIT_OID_HEXSZ encoding:NSUTF8StringEncoding freeWhenDone:YES];
36-
if (str == nil) free(SHA);
30+
char *SHA = git_oid_tostr_s(self.git_oid);
31+
NSString *str = [[NSString alloc] initWithBytes:SHA
32+
length:GIT_OID_HEXSZ
33+
encoding:NSUTF8StringEncoding];
34+
NSAssert(str != nil, @"Failed to create SHA string");
3735
return str;
3836
}
3937

ObjectiveGit/GTRepository.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) {
178178
@interface GTRepository : NSObject
179179

180180
/// The file URL for the repository's working directory.
181+
/// Returns nil for a bare repository.
181182
@property (nonatomic, readonly, strong, nullable) NSURL *fileURL;
182183
/// The file URL for the repository's .git directory.
183184
@property (nonatomic, readonly, strong, nullable) NSURL *gitDirectoryURL;

0 commit comments

Comments
 (0)