Skip to content

Commit

Permalink
Merge pull request #651 from libgit2/xcode-9.3
Browse files Browse the repository at this point in the history
πŸ‘·πŸ»β€β™€οΈπŸ›  Xcode 9.3
  • Loading branch information
phatblat authored Apr 10, 2018
2 parents e22dfba + 7895ba9 commit 021a9a7
Show file tree
Hide file tree
Showing 71 changed files with 425 additions and 271 deletions.
18 changes: 15 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
osx_image: xcode8.3
#
# .travis.yml
# Objective-Git
#
# https://docs.travis-ci.com/user/reference/osx/
# https://docs.travis-ci.com/user/build-stages/matrix-expansion/
#
---
os: osx
osx_image: xcode9.3
language: objective-c

matrix:
fast_finish: true
include:
- osx_image: xcode8.3
- osx_image: xcode9.3
env:
- SCHEME="ObjectiveGit Mac"
- osx_image: xcode8.3
- osx_image: xcode9.3
env:
- SCHEME="ObjectiveGit iOS"

before_install:
- gem install xcpretty
- gem install xcpretty-travis-formatter
install: script/bootstrap
script: script/cibuild

notifications:
email: false
8 changes: 4 additions & 4 deletions Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "jspahrsummers/xcconfigs" >= 0.7.1
github "Quick/Quick" ~> 1.1.0
github "Quick/Nimble" ~> 5.0
github "ZipArchive/ZipArchive" ~> 1.1
github "jspahrsummers/xcconfigs" "master"
github "Quick/Quick" ~> 1.2.0
github "Quick/Nimble" ~> 7.0.3
github "ZipArchive/ZipArchive" ~> 2.1.2
8 changes: 4 additions & 4 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "Quick/Nimble" "v5.1.1"
github "Quick/Quick" "v1.1.0"
github "ZipArchive/ZipArchive" "v1.8.1"
github "jspahrsummers/xcconfigs" "0.10"
github "Quick/Nimble" "v7.0.3"
github "Quick/Quick" "v1.2.0"
github "ZipArchive/ZipArchive" "v2.1.2"
github "jspahrsummers/xcconfigs" "bb795558a76e5daf3688500055bbcfe243bffa8d"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Nimble
Submodule Nimble updated 146 files
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Quick
Submodule Quick updated 46 files
+0 βˆ’39 .Package.test.swift
+2 βˆ’1 .gitignore
+1 βˆ’1 .swift-version
+1 βˆ’2 .swiftlint.yml
+15 βˆ’1 .travis.yml
+1 βˆ’1 Documentation/ja/ConfiguringQuick.md
+1 βˆ’1 Externals/Nimble
+17 βˆ’3 Package.swift
+40 βˆ’0 [email protected]
+1 βˆ’1 Quick.podspec
+83 βˆ’32 Quick.xcodeproj/project.pbxproj
+17 βˆ’1 Quick.xcodeproj/xcshareddata/xcschemes/Quick-iOS.xcscheme
+17 βˆ’1 Quick.xcodeproj/xcshareddata/xcschemes/Quick-macOS.xcscheme
+17 βˆ’1 Quick.xcodeproj/xcshareddata/xcschemes/Quick-tvOS.xcscheme
+4 βˆ’5 Rakefile
+17 βˆ’0 Sources/Quick/Behavior.swift
+14 βˆ’1 Sources/Quick/Callsite.swift
+2 βˆ’2 Sources/Quick/Configuration/Configuration.swift
+4 βˆ’4 Sources/Quick/Configuration/QuickConfiguration.swift
+30 βˆ’0 Sources/Quick/DSL/DSL.swift
+33 βˆ’3 Sources/Quick/DSL/World+DSL.swift
+1 βˆ’1 Sources/Quick/ErrorUtility.swift
+20 βˆ’2 Sources/Quick/Example.swift
+5 βˆ’9 Sources/Quick/ExampleGroup.swift
+14 βˆ’1 Sources/Quick/ExampleMetadata.swift
+14 βˆ’1 Sources/Quick/Filter.swift
+1 βˆ’1 Sources/Quick/NSBundle+CurrentTestBundle.swift
+2 βˆ’2 Sources/Quick/NSString+C99ExtendedIdentifier.swift
+1 βˆ’1 Sources/Quick/QuickSelectedTestSuiteBuilder.swift
+2 βˆ’2 Sources/Quick/QuickSpec.swift
+6 βˆ’6 Sources/Quick/QuickTestSuite.swift
+17 βˆ’3 Sources/Quick/World.swift
+2 βˆ’2 Sources/QuickSpecBase/include/QuickSpecBase.h
+10 βˆ’1 Tests/QuickTests/QuickFocusedTests/FocusedTests.swift
+1 βˆ’1 Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift
+20 βˆ’0 Tests/QuickTests/QuickTests/Fixtures/FunctionalTests_BehaviorTests_Behaviors.swift
+20 βˆ’21 Tests/QuickTests/QuickTests/FunctionalTests/AfterEachTests.swift
+17 βˆ’18 Tests/QuickTests/QuickTests/FunctionalTests/BeforeEachTests.swift
+59 βˆ’0 Tests/QuickTests/QuickTests/FunctionalTests/BehaviorTests.swift
+1 βˆ’1 Tests/QuickTests/QuickTests/FunctionalTests/ContextTests.swift
+2 βˆ’2 Tests/QuickTests/QuickTests/FunctionalTests/CrossReferencingSpecs.swift
+1 βˆ’1 Tests/QuickTests/QuickTests/FunctionalTests/DescribeTests.swift
+4 βˆ’4 Tests/QuickTests/QuickTests/FunctionalTests/ItTests.swift
+1 βˆ’1 Tests/QuickTests/QuickTests/FunctionalTests/ObjC/FailureUsingXCTAssertTests+ObjC.m
+8 βˆ’1 Tests/QuickTests/QuickTests/FunctionalTests/PendingTests.swift
+2 βˆ’2 Tests/QuickTests/QuickTests/FunctionalTests/SharedExamplesTests.swift
2 changes: 1 addition & 1 deletion Carthage/Checkouts/ZipArchive
Submodule ZipArchive updated 87 files
+6 βˆ’14 .gitignore
+83 βˆ’3 .travis.yml
+443 βˆ’76 ObjectiveCExample/ObjectiveCExample.xcodeproj/project.pbxproj
+25 βˆ’4 ObjectiveCExample/ObjectiveCExample.xcodeproj/xcshareddata/xcschemes/ObjectiveCExample_iOS.xcscheme
+72 βˆ’0 ObjectiveCExample/ObjectiveCExample.xcodeproj/xcshareddata/xcschemes/ObjectiveCExample_macOS.xcscheme
+72 βˆ’0 ObjectiveCExample/ObjectiveCExample.xcodeproj/xcshareddata/xcschemes/ObjectiveCExample_tvOS.xcscheme
+8 βˆ’0 ObjectiveCExample/ObjectiveCExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+1 βˆ’1 ObjectiveCExample/ObjectiveCExample/AppDelegate.m
+41 βˆ’30 ObjectiveCExample/ObjectiveCExample/Base.lproj/Main.storyboard
+96 βˆ’78 ObjectiveCExample/ObjectiveCExample/ViewController.m
+17 βˆ’0 ObjectiveCExample/ObjectiveCExampleTests/CancelDelegate.h
+29 βˆ’0 ObjectiveCExample/ObjectiveCExampleTests/CancelDelegate.m
+2 βˆ’2 ObjectiveCExample/ObjectiveCExampleTests/CollectingDelegate.h
+5 βˆ’10 ObjectiveCExample/ObjectiveCExampleTests/CollectingDelegate.m
+ βˆ’ ObjectiveCExample/ObjectiveCExampleTests/Fixtures/Empty.zip
+17 βˆ’0 ObjectiveCExample/ObjectiveCExampleTests/ProgressDelegate.h
+46 βˆ’0 ObjectiveCExample/ObjectiveCExampleTests/ProgressDelegate.m
+196 βˆ’145 ObjectiveCExample/ObjectiveCExampleTests/SSZipArchiveTests.m
+18 βˆ’8 ObjectiveCExample/Podfile
+4 βˆ’4 ObjectiveCExample/Podfile.lock
+19 βˆ’10 README.md
+5 βˆ’6 SSZipArchive.podspec
+0 βˆ’25 SSZipArchive/SSZipArchive+Swift.swift
+65 βˆ’22 SSZipArchive/SSZipArchive.h
+483 βˆ’287 SSZipArchive/SSZipArchive.m
+47 βˆ’62 SSZipArchive/SSZipCommon.h
+1 βˆ’1 SSZipArchive/ZipArchive.h
+0 βˆ’541 SSZipArchive/aes/aes_via_ace.h
+0 βˆ’54 SSZipArchive/aes/entropy.c
+0 βˆ’16 SSZipArchive/aes/entropy.h
+0 βˆ’145 SSZipArchive/aes/hmac.c
+0 βˆ’103 SSZipArchive/aes/hmac.h
+0 βˆ’57 SSZipArchive/aes/pwd2key.h
+0 βˆ’73 SSZipArchive/aes/sha1.h
+270 βˆ’198 SSZipArchive/minizip/aes/aes.h
+687 βˆ’0 SSZipArchive/minizip/aes/aes_ni.c
+59 βˆ’0 SSZipArchive/minizip/aes/aes_ni.h
+301 βˆ’294 SSZipArchive/minizip/aes/aescrypt.c
+554 βˆ’548 SSZipArchive/minizip/aes/aeskey.c
+776 βˆ’739 SSZipArchive/minizip/aes/aesopt.h
+418 βˆ’391 SSZipArchive/minizip/aes/aestab.c
+173 βˆ’173 SSZipArchive/minizip/aes/aestab.h
+127 βˆ’126 SSZipArchive/minizip/aes/brg_endian.h
+191 βˆ’219 SSZipArchive/minizip/aes/brg_types.h
+145 βˆ’144 SSZipArchive/minizip/aes/fileenc.c
+121 βˆ’121 SSZipArchive/minizip/aes/fileenc.h
+209 βˆ’0 SSZipArchive/minizip/aes/hmac.c
+119 βˆ’0 SSZipArchive/minizip/aes/hmac.h
+155 βˆ’155 SSZipArchive/minizip/aes/prng.c
+82 βˆ’82 SSZipArchive/minizip/aes/prng.h
+181 βˆ’193 SSZipArchive/minizip/aes/pwd2key.c
+45 βˆ’0 SSZipArchive/minizip/aes/pwd2key.h
+283 βˆ’258 SSZipArchive/minizip/aes/sha1.c
+72 βˆ’0 SSZipArchive/minizip/aes/sha1.h
+144 βˆ’0 SSZipArchive/minizip/crypt.c
+40 βˆ’106 SSZipArchive/minizip/crypt.h
+71 βˆ’87 SSZipArchive/minizip/ioapi.c
+35 βˆ’56 SSZipArchive/minizip/ioapi.h
+461 βˆ’0 SSZipArchive/minizip/ioapi_buf.c
+52 βˆ’0 SSZipArchive/minizip/ioapi_buf.h
+167 βˆ’0 SSZipArchive/minizip/ioapi_mem.c
+52 βˆ’0 SSZipArchive/minizip/ioapi_mem.h
+292 βˆ’0 SSZipArchive/minizip/minishared.c
+51 βˆ’0 SSZipArchive/minizip/minishared.h
+0 βˆ’284 SSZipArchive/minizip/mztools.c
+0 βˆ’31 SSZipArchive/minizip/mztools.h
+1,004 βˆ’848 SSZipArchive/minizip/unzip.c
+65 βˆ’60 SSZipArchive/minizip/unzip.h
+977 βˆ’885 SSZipArchive/minizip/zip.c
+85 βˆ’72 SSZipArchive/minizip/zip.h
+1 βˆ’0 SwiftExample/Podfile
+4 βˆ’4 SwiftExample/Podfile.lock
+37 βˆ’28 SwiftExample/SwiftExample.xcodeproj/project.pbxproj
+108 βˆ’0 SwiftExample/SwiftExample.xcodeproj/xcshareddata/xcschemes/SwiftExample.xcscheme
+91 βˆ’0 SwiftExample/SwiftExample.xcodeproj/xcshareddata/xcschemes/SwiftExampleCarthage.xcscheme
+8 βˆ’0 SwiftExample/SwiftExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+1 βˆ’1 SwiftExample/SwiftExample/AppDelegate.swift
+25 βˆ’0 SwiftExample/SwiftExample/Assets.xcassets/AppIcon.appiconset/Contents.json
+25 βˆ’16 SwiftExample/SwiftExample/Base.lproj/Main.storyboard
+29 βˆ’12 SwiftExample/SwiftExample/ViewController.swift
+579 βˆ’157 ZipArchive.xcodeproj/project.pbxproj
+8 βˆ’0 ZipArchive.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+1 βˆ’1 ZipArchive.xcodeproj/xcshareddata/xcschemes/ZipArchive-Mac.xcscheme
+1 βˆ’1 ZipArchive.xcodeproj/xcshareddata/xcschemes/ZipArchive-iOS.xcscheme
+80 βˆ’0 ZipArchive.xcodeproj/xcshareddata/xcschemes/ZipArchive-tvos.xcscheme
+80 βˆ’0 ZipArchive.xcodeproj/xcshareddata/xcschemes/ZipArchive-watchos.xcscheme
+ βˆ’ icon.png
2 changes: 1 addition & 1 deletion Carthage/Checkouts/xcconfigs
4 changes: 2 additions & 2 deletions ObjectiveGit/GTBlob.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ NS_ASSUME_NONNULL_BEGIN
- (git_blob *)git_blob __attribute__((objc_returns_inner_pointer));

- (git_off_t)size;
- (NSString *)content;
- (NSData * _Nullable)data;
- (NSString * _Nullable)content;
- (NSData *)data;

/// Attempts to apply the filter list for `path` to the blob.
///
Expand Down
46 changes: 34 additions & 12 deletions ObjectiveGit/GTBranch.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,23 @@ - (NSString *)remoteName {
}

- (GTCommit *)targetCommitWithError:(NSError **)error {
if (self.OID == nil) {
GTOID *oid = self.OID;
if (oid == nil) {
if (error != NULL) *error = GTReference.invalidReferenceError;
return nil;
}

return [self.repository lookUpObjectByOID:self.OID objectType:GTObjectTypeCommit error:error];
return [self.repository lookUpObjectByOID:oid objectType:GTObjectTypeCommit error:error];
}

- (NSUInteger)numberOfCommitsWithError:(NSError **)error {
GTEnumerator *enumerator = [[GTEnumerator alloc] initWithRepository:self.repository error:error];
if (enumerator == nil) return NSNotFound;

if (![enumerator pushSHA:self.OID.SHA error:error]) return NSNotFound;
GTOID *oid = self.OID;
if (oid == nil) return NSNotFound;

if (![enumerator pushSHA:oid.SHA error:error]) return NSNotFound;
return [enumerator countRemainingObjects:error];
}

Expand All @@ -157,7 +161,9 @@ - (BOOL)isHEAD {
}

- (NSArray *)uniqueCommitsRelativeToBranch:(GTBranch *)otherBranch error:(NSError **)error {
GTEnumerator *enumerator = [self.repository enumeratorForUniqueCommitsFromOID:self.OID relativeToOID:otherBranch.OID error:error];
GTOID *oid = self.OID;
GTOID *otherOID = otherBranch.OID;
GTEnumerator *enumerator = [self.repository enumeratorForUniqueCommitsFromOID:oid relativeToOID:otherOID error:error];
return [enumerator allObjectsWithError:error];
}

Expand All @@ -179,14 +185,21 @@ - (BOOL)rename:(NSString *)name force:(BOOL)force error:(NSError **)error {
return NO;
}

_reference = [[GTReference alloc] initWithGitReference:git_ref repository:self.repository];
GTReference *renamedRef = [[GTReference alloc] initWithGitReference:git_ref repository:self.repository];
NSAssert(renamedRef, @"Unable to allocate renamed ref");
_reference = renamedRef;

return YES;
}

- (GTBranch *)trackingBranchWithError:(NSError **)error success:(BOOL *)success {
BOOL underSuccess = NO;
if (success == NULL) {
success = &underSuccess;
}

if (self.branchType == GTBranchTypeRemote) {
if (success != NULL) *success = YES;
*success = YES;
return self;
}

Expand All @@ -195,25 +208,32 @@ - (GTBranch *)trackingBranchWithError:(NSError **)error success:(BOOL *)success

// GIT_ENOTFOUND means no tracking branch found.
if (gitError == GIT_ENOTFOUND) {
if (success != NULL) *success = YES;
*success = YES;
return nil;
}

if (gitError != GIT_OK) {
if (success != NULL) *success = NO;
*success = NO;
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to create reference to tracking branch from %@", self];
return nil;
}

if (trackingRef == NULL) {
if (success != NULL) *success = NO;
*success = NO;
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Got a NULL remote ref for %@", self];
return nil;
}

if (success != NULL) *success = YES;
GTReference *upsteamRef = [[GTReference alloc] initWithGitReference:trackingRef repository:self.repository];
if (upsteamRef == nil) {
*success = NO;
if (error != NULL) *error = [NSError git_errorFor:GIT_ERROR description:@"Failed to allocate upstream ref"];
return nil;
}

*success = YES;

return [[self class] branchWithReference:[[GTReference alloc] initWithGitReference:trackingRef repository:self.repository]];
return [[self class] branchWithReference:upsteamRef];
}

- (BOOL)updateTrackingBranch:(GTBranch *)trackingBranch error:(NSError **)error {
Expand All @@ -239,7 +259,9 @@ - (GTBranch *)reloadedBranchWithError:(NSError **)error {
}

- (BOOL)calculateAhead:(size_t *)ahead behind:(size_t *)behind relativeTo:(GTBranch *)branch error:(NSError **)error {
return [self.repository calculateAhead:ahead behind:behind ofOID:self.OID relativeToOID:branch.OID error:error];
GTOID *oid = self.OID;
GTOID *branchOID = branch.OID;
return [self.repository calculateAhead:ahead behind:behind ofOID:oid relativeToOID:branchOID error:error];
}

@end
4 changes: 2 additions & 2 deletions ObjectiveGit/GTCheckoutOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ typedef NS_OPTIONS(NSInteger, GTCheckoutNotifyFlags) {
@property (assign) GTCheckoutStrategyType strategy;

/// The checkout progress block that was passed in.
@property (copy) void (^progressBlock)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps);
@property (copy, nullable) void (^progressBlock)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps);

/// The notification flags currently enabled.
@property (assign) GTCheckoutNotifyFlags notifyFlags;

/// The checkout notification block that was passed in.
@property (copy) int (^notifyBlock)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir);
@property (copy, nullable) int (^notifyBlock)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir);

/// An array of strings used to restrict what will be checked out.
@property (copy) NSArray <NSString *> *pathSpecs;
Expand Down
8 changes: 5 additions & 3 deletions ObjectiveGit/GTConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,12 @@ - (NSArray *)remotes {
NSMutableArray *remotes = [NSMutableArray arrayWithCapacity:names.count];
for (size_t i = 0; i < names.count; i++) {
const char *name = names.strings[i];
git_remote *remote = NULL;
git_remote *git_remote = NULL;

if (git_remote_lookup(&remote, repository.git_repository, name) == 0) {
[remotes addObject:[[GTRemote alloc] initWithGitRemote:remote inRepository:repository]];
if (git_remote_lookup(&git_remote, repository.git_repository, name) == 0) {
GTRemote *remote = [[GTRemote alloc] initWithGitRemote:git_remote inRepository:repository];
if (remote)
[remotes addObject:remote];
}
}

Expand Down
4 changes: 2 additions & 2 deletions ObjectiveGit/GTDiffDelta.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign, readonly) GTDiffFileFlag flags;

/// The file to the "left" of the diff.
@property (nonatomic, readonly, copy) GTDiffFile *oldFile;
@property (nonatomic, readonly, copy) GTDiffFile * _Nullable oldFile;

/// The file to the "right" of the diff.
@property (nonatomic, readonly, copy) GTDiffFile *newFile __attribute__((ns_returns_not_retained));
@property (nonatomic, readonly, copy) GTDiffFile * _Nullable newFile __attribute__((ns_returns_not_retained));

/// The type of change that this delta represents.
///
Expand Down
4 changes: 3 additions & 1 deletion ObjectiveGit/GTDiffHunk.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ - (instancetype)initWithPatch:(GTDiffPatch *)patch hunkIndex:(NSUInteger)hunkInd

_patch = patch;
_hunkIndex = hunkIndex;
_header = [[[NSString alloc] initWithBytes:self.git_hunk->header length:self.git_hunk->header_len encoding:NSUTF8StringEncoding] stringByTrimmingCharactersInSet:NSCharacterSet.newlineCharacterSet];
NSString *hunkHeader = [[[NSString alloc] initWithBytes:self.git_hunk->header length:self.git_hunk->header_len encoding:NSUTF8StringEncoding] stringByTrimmingCharactersInSet:NSCharacterSet.newlineCharacterSet];
NSAssert(hunkHeader != nil, @"Failed to build hunk header");
_header = hunkHeader;

return self;
}
Expand Down
3 changes: 2 additions & 1 deletion ObjectiveGit/GTEnumerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ - (NSUInteger)countRemainingObjects:(NSError **)error {
#pragma mark NSEnumerator

- (NSArray *)allObjects {
return [self allObjectsWithError:NULL];
NSArray *objects = [self allObjectsWithError:NULL];
return objects ? objects : [NSArray array];
}

- (id)nextObject {
Expand Down
4 changes: 3 additions & 1 deletion ObjectiveGit/GTFilter.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ static void GTFilterShutdown(git_filter *filter) {

static int GTFilterCheck(git_filter *filter, void **payload, const git_filter_source *src, const char **attr_values) {
GTFilter *self = GTFiltersGitFilterToRegisteredFilters[[NSValue valueWithPointer:filter]];
BOOL accept = self.checkBlock(payload, [[GTFilterSource alloc] initWithGitFilterSource:src], attr_values);
GTFilterSource *source = [[GTFilterSource alloc] initWithGitFilterSource:src];
NSCAssert(source != nil, @"Unexpected nil filter source");
BOOL accept = self.checkBlock(payload, source, attr_values);
return accept ? 0 : GIT_PASSTHROUGH;
}

Expand Down
4 changes: 3 additions & 1 deletion ObjectiveGit/GTIndex.m
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@ - (GTTree *)writeTreeToRepository:(GTRepository *)repository error:(NSError **)e
- (NSArray *)entries {
NSMutableArray *entries = [NSMutableArray arrayWithCapacity:self.entryCount];
for (NSUInteger i = 0; i < self.entryCount; i++) {
[entries addObject:[self entryAtIndex:i]];
GTIndexEntry *entry = [self entryAtIndex:i];
if (entry)
[entries addObject:entry];
}

return entries;
Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/GTOID.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface GTOID : NSObject <NSCopying>

/// The SHA pointed to by the OID.
@property (nonatomic, readonly, copy) NSString * _Nullable SHA;
@property (nonatomic, readonly, copy) NSString *SHA;

/// Is the OID all zero? This usually indicates that the object has not been
/// inserted into the ODB yet.
Expand Down
4 changes: 3 additions & 1 deletion ObjectiveGit/GTOID.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ - (instancetype)initWithGitOid:(const git_oid *)oid {

- (instancetype)initWithSHA:(NSString *)SHA error:(NSError **)error {
NSParameterAssert(SHA != nil);
return [self initWithSHACString:SHA.UTF8String error:error];
const char *SHACString = SHA.UTF8String;
NSAssert(SHACString, @"Unexpected nil SHA");
return [self initWithSHACString:SHACString error:error];
}

- (instancetype)initWithSHA:(NSString *)SHA {
Expand Down
6 changes: 3 additions & 3 deletions ObjectiveGit/GTObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ NS_ASSUME_NONNULL_BEGIN
@interface GTObject : NSObject

@property (nonatomic, readonly) NSString *type;
@property (nonatomic, readonly) NSString * _Nullable SHA;
@property (nonatomic, readonly) NSString * _Nullable shortSHA;
@property (nonatomic, readonly) NSString *SHA;
@property (nonatomic, readonly) NSString *shortSHA;
@property (nonatomic, readonly, strong) GTRepository *repository;
@property (nonatomic, readonly) GTOID * _Nullable OID;
@property (nonatomic, readonly) GTOID *OID;

- (instancetype)init NS_UNAVAILABLE;

Expand Down
4 changes: 3 additions & 1 deletion ObjectiveGit/GTObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ + (id)objectWithObj:(git_object *)theObject inRepository:(GTRepository *)theRepo
}

- (NSString *)type {
return [NSString stringWithUTF8String:git_object_type2string(git_object_type(self.git_object))];
NSString *type = [NSString stringWithUTF8String:git_object_type2string(git_object_type(self.git_object))];
NSAssert(type != nil, @"type was nil");
return type;
}

- (GTOID *)OID {
Expand Down
6 changes: 3 additions & 3 deletions ObjectiveGit/GTReference.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly, getter = isNote) BOOL note;

/// The reflog for the reference.
@property (nonatomic, readonly, strong) GTReflog *reflog;
@property (nonatomic, readonly, strong) GTReflog * _Nullable reflog;

/// Convenience initializers
+ (instancetype _Nullable)referenceByResolvingSymbolicReference:(GTReference *)symbolicRef error:(NSError **)error;
Expand Down Expand Up @@ -96,7 +96,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly, copy) GTReference *resolvedReference;

/// The OID of the target object.
@property (nonatomic, readonly, copy) GTOID *targetOID;
@property (nonatomic, readonly, copy, nullable) GTOID *targetOID;

/// Updates the on-disk reference to point to the target and returns the updated
/// reference.
Expand All @@ -112,7 +112,7 @@ NS_ASSUME_NONNULL_BEGIN
- (GTReference * _Nullable)referenceByUpdatingTarget:(NSString *)newTarget message:(NSString * _Nullable)message error:(NSError **)error;

/// The name of the reference.
@property (nonatomic, readonly, copy) NSString * _Nullable name;
@property (nonatomic, readonly, copy) NSString *name;

/// Updates the on-disk reference to the name and returns the renamed reference.
///
Expand Down
5 changes: 3 additions & 2 deletions ObjectiveGit/GTReference.m
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ - (BOOL)isNote {

- (NSString *)name {
const char *refName = git_reference_name(self.git_reference);
if (refName == NULL) return nil;
NSAssert(refName != nil, @"Unexpected nil name");

return @(refName);
}
Expand Down Expand Up @@ -166,7 +166,8 @@ - (id)resolvedTarget {
}

- (GTReference *)resolvedReference {
return [self.class referenceByResolvingSymbolicReference:self error:NULL];
GTReference *resolvedReference = [self.class referenceByResolvingSymbolicReference:self error:NULL];
return resolvedReference ? resolvedReference : self;
}

- (GTOID *)targetOID {
Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/GTRepository.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) {
/// defaults will be used instead. Will never return nil.
///
/// Returns the signature.
- (GTSignature *)userSignatureForNow;
- (GTSignature * _Nullable)userSignatureForNow;

/// Enumerates over all the tracked submodules in the repository.
///
Expand Down
4 changes: 3 additions & 1 deletion ObjectiveGit/GTRepository.m
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ - (instancetype)initWithURL:(NSURL *)localFileURL flags:(NSInteger)flags ceiling
if (idx < ceilingDirURLs.count - 1) {
[ceilingDirsString appendString:[NSString stringWithFormat:@"%@%c", url.path, GIT_PATH_LIST_SEPARATOR]];
} else {
[ceilingDirsString appendString:url.path];
NSString *path = url.path;
NSAssert(path != nil, @"Unexpected nil path component");
[ceilingDirsString appendString:path];
}
}];
}
Expand Down
Loading

0 comments on commit 021a9a7

Please sign in to comment.