From a30e16022ba88c8d743cfdd0cd15059543a43fb8 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Wed, 6 Jan 2016 20:37:51 -0700 Subject: [PATCH 001/228] Change minimum version of Xcode on readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 76f504f4c..948707f06 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ The ObjectiveGit API makes extensive use of the Cocoa NSError pattern. The publi ### Xcode -ObjectiveGit requires Xcode 6.3 or greater to build the framework and run unit tests. Projects that must use an older version of Xcode can use +ObjectiveGit requires Xcode 7 or greater to build the framework and run unit tests. Projects that must use an older version of Xcode can use [Carthage](#carthage) to install pre-built binaries or download them [manually](#manually). From eb0f40f1d1227381c4ac44389094ac55f4539ec2 Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Fri, 22 Jan 2016 11:53:36 +0800 Subject: [PATCH 002/228] Add list of files to merge conflict error --- ObjectiveGit/GTRepository+Pull.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ObjectiveGit/GTRepository+Pull.m b/ObjectiveGit/GTRepository+Pull.m index 24bbb3e2d..c50810f83 100644 --- a/ObjectiveGit/GTRepository+Pull.m +++ b/ObjectiveGit/GTRepository+Pull.m @@ -17,6 +17,7 @@ #import "GTRepository+RemoteOperations.h" #import "GTTree.h" #import "NSError+Git.h" +#import "GTIndexEntry.h" #import "git2/errors.h" @implementation GTRepository (Pull) @@ -106,7 +107,17 @@ - (BOOL)pullBranch:(GTBranch *)branch fromRemote:(GTRemote *)remote withOptions: // Check for conflict if (index.hasConflicts) { - if (error != NULL) *error = [NSError git_errorFor:GIT_ECONFLICT description:@"Merge conflict, pull aborted"]; + NSMutableArray *files = [NSMutableArray array]; + [index enumerateConflictedFilesWithError:error usingBlock:^(GTIndexEntry * _Nonnull ancestor, GTIndexEntry * _Nonnull ours, GTIndexEntry * _Nonnull theirs, BOOL * _Nonnull stop) { + [files addObject:ours.path]; + }]; + if (error != NULL) { + if (files.count > 0) { + *error = [NSError git_errorFor:GIT_ECONFLICT description:@"Merge conflict in files: %@. Pull aborted.", [files componentsJoinedByString:@", "]]; + } else { + *error = [NSError git_errorFor:GIT_ECONFLICT description:@"Merge conflict, pull aborted"]; + } + } return NO; } From 53c4f5fd0248831fa5a7c119f57cac0d4c291204 Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Fri, 22 Jan 2016 16:18:59 +0300 Subject: [PATCH 003/228] =?UTF-8?q?+[GTDiff=20diffOldTree:withNewIndex:?= =?UTF-8?q?=E2=80=A6]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding support for diffing a tree and an arbitrary GTIndex (for in-mem comparisons of pending merges) --- ObjectiveGit/GTDiff.h | 18 ++++++++++++++++++ ObjectiveGit/GTDiff.m | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/ObjectiveGit/GTDiff.h b/ObjectiveGit/GTDiff.h index 68a510f4e..e3ea606fb 100644 --- a/ObjectiveGit/GTDiff.h +++ b/ObjectiveGit/GTDiff.h @@ -13,6 +13,7 @@ @class GTDiffDelta; @class GTRepository; @class GTTree; +@class GTIndex; NS_ASSUME_NONNULL_BEGIN @@ -200,6 +201,23 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// Returns a newly created `GTDiff` object or nil on error. + (nullable instancetype)diffOldTree:(nullable GTTree *)oldTree withNewTree:(nullable GTTree *)newTree inRepository:(GTRepository *)repository options:(nullable NSDictionary *)options error:(NSError **)error; +/// Create a diff between `GTTree` and `GTIndex`. +/// +/// Both instances must be from the same repository, or an exception will be thrown. +/// +/// oldTree - The "left" side of the diff. May be nil to represent an empty +/// tree. +/// newIndex - The "right" side of the diff. May be nil to represent an empty +/// index. +/// repository - The repository to be used for the diff. Cannot be nil. +/// options - A dictionary containing any of the above options key constants, or +/// nil to use the defaults. +/// error - Populated with an `NSError` object on error, if information is +/// available. +/// +/// Returns a newly created `GTDiff` object or nil on error. ++ (nullable instancetype)diffOldTree:(nullable GTTree *)oldTree withNewIndex:(nullable GTIndex *)newIndex inRepository:(GTRepository *)repository options:(nullable NSDictionary *)options error:(NSError **)error; + /// Create a diff between a repository's current index. /// /// This is equivalent to `git diff --cached ` or if you pass the HEAD diff --git a/ObjectiveGit/GTDiff.m b/ObjectiveGit/GTDiff.m index 75e76377e..06b09c59b 100644 --- a/ObjectiveGit/GTDiff.m +++ b/ObjectiveGit/GTDiff.m @@ -11,6 +11,7 @@ #import "GTCommit.h" #import "GTRepository.h" #import "GTTree.h" +#import "GTIndex.h" #import "NSArray+StringArray.h" #import "NSError+Git.h" @@ -94,6 +95,21 @@ + (instancetype)diffOldTree:(GTTree *)oldTree withNewTree:(GTTree *)newTree inRe return [[self alloc] initWithGitDiff:diff repository:repository]; } ++ (instancetype)diffOldTree:(GTTree *)oldTree withNewIndex:(GTIndex *)newIndex inRepository:(GTRepository *)repository options:(NSDictionary *)options error:(NSError **)error { + NSParameterAssert(repository != nil); + + __block git_diff *diff; + int status = [self handleParsedOptionsDictionary:options usingBlock:^(git_diff_options *optionsStruct) { + return git_diff_tree_to_index(&diff, repository.git_repository, oldTree.git_tree, newIndex.git_index, optionsStruct); + }]; + if (status != GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:status description:@"Failed to create diff between %@ and %@", oldTree.SHA, newIndex]; + return nil; + } + + return [[self alloc] initWithGitDiff:diff repository:repository]; +} + + (instancetype)diffIndexFromTree:(GTTree *)tree inRepository:(GTRepository *)repository options:(NSDictionary *)options error:(NSError **)error { NSParameterAssert(repository != nil); NSParameterAssert(tree == nil || [tree.repository isEqual:repository]); From 1a86570d80ad67e1512a547818db8f9d834326e9 Mon Sep 17 00:00:00 2001 From: Ian Beck Date: Tue, 26 Jan 2016 14:16:15 -0800 Subject: [PATCH 004/228] Added missing nullable keyword to [GTIndex entryWithPath:path] convenience method --- ObjectiveGit/GTIndex.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ObjectiveGit/GTIndex.h b/ObjectiveGit/GTIndex.h index 35bdaefae..c419c4e7c 100644 --- a/ObjectiveGit/GTIndex.h +++ b/ObjectiveGit/GTIndex.h @@ -107,8 +107,8 @@ NS_ASSUME_NONNULL_BEGIN /// Returns a new GTIndexEntry, or nil if an error occurred. - (nullable GTIndexEntry *)entryAtIndex:(NSUInteger)index; -/// Get the entry with the given path. -- (GTIndexEntry *)entryWithPath:(NSString *)path; +/// Get the entry with the given path, or nil if an error occurred. +- (nullable GTIndexEntry *)entryWithPath:(NSString *)path; /// Get the entry with the given name. /// From 4ee75c4486b637a2b805234285d57684993da2c0 Mon Sep 17 00:00:00 2001 From: Ian Beck Date: Wed, 27 Jan 2016 11:04:12 -0800 Subject: [PATCH 005/228] Fixed erroneous shouldIgnoreFile return value; updated documentation comment to reflect usage of NSURL instead of NSString --- ObjectiveGit/GTRepository+Status.h | 2 +- ObjectiveGit/GTRepository+Status.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ObjectiveGit/GTRepository+Status.h b/ObjectiveGit/GTRepository+Status.h index d21e34fe7..b0e1e7f65 100644 --- a/ObjectiveGit/GTRepository+Status.h +++ b/ObjectiveGit/GTRepository+Status.h @@ -126,7 +126,7 @@ extern NSString *const GTRepositoryStatusOptionsPathSpecArrayKey; /// Tests the ignore rules to see if the file should be considered as ignored. /// -/// fileURL - A string path relative to the working copy. Must not be nil. +/// fileURL - A local file URL for a file in the repository. Must not be nil. /// success - If not NULL, will be set to indicate success or fail. /// error - If not nil, set to any error that occurs. /// diff --git a/ObjectiveGit/GTRepository+Status.m b/ObjectiveGit/GTRepository+Status.m index e5e236902..a7821b44a 100644 --- a/ObjectiveGit/GTRepository+Status.m +++ b/ObjectiveGit/GTRepository+Status.m @@ -122,7 +122,7 @@ - (BOOL)shouldFileBeIgnored:(NSURL *)fileURL success:(BOOL *)success error:(NSEr } if (success != NULL) *success = YES; - return (ignoreState == 0 ? YES : NO); + return (ignoreState == 1 ? YES : NO); } @end From 233527db6c1ac4c54b189f6ef9577f597cb3117a Mon Sep 17 00:00:00 2001 From: Ian Beck Date: Thu, 28 Jan 2016 09:18:52 -0800 Subject: [PATCH 006/228] Added shouldIgnoreFileURL:error: convenience wrapper to GTRepository+Status for compatibility with Swift; closes #541 --- ObjectiveGit/GTRepository+Status.h | 10 ++++++++++ ObjectiveGit/GTRepository+Status.m | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/ObjectiveGit/GTRepository+Status.h b/ObjectiveGit/GTRepository+Status.h index b0e1e7f65..be12965da 100644 --- a/ObjectiveGit/GTRepository+Status.h +++ b/ObjectiveGit/GTRepository+Status.h @@ -133,6 +133,16 @@ extern NSString *const GTRepositoryStatusOptionsPathSpecArrayKey; /// Returns YES if the file should be ignored; NO otherwise. - (BOOL)shouldFileBeIgnored:(NSURL *)fileURL success:(nullable BOOL *)success error:(NSError **)error; +/// An enum for use with shouldIgnoreFileURL:error: below +typedef NS_ENUM(NSInteger, GTFileIgnoreState) { + GTFileIgnoreStateIgnoreCheckFailed = -1, + GTFileIgnoreStateShouldNotIgnore = 0, + GTFileIgnoreStateShouldIgnore = 1 +}; + +/// Convenience wrapper for shouldFileBeIgnored:success:error: +- (GTFileIgnoreState)shouldIgnoreFileURL:(NSURL *)fileURL error:(NSError **)error; + @end NS_ASSUME_NONNULL_END diff --git a/ObjectiveGit/GTRepository+Status.m b/ObjectiveGit/GTRepository+Status.m index a7821b44a..bfc319091 100644 --- a/ObjectiveGit/GTRepository+Status.m +++ b/ObjectiveGit/GTRepository+Status.m @@ -125,4 +125,10 @@ - (BOOL)shouldFileBeIgnored:(NSURL *)fileURL success:(BOOL *)success error:(NSEr return (ignoreState == 1 ? YES : NO); } +- (GTFileIgnoreState)shouldIgnoreFileURL:(NSURL *)fileURL error:(NSError **)error { + BOOL success = false; + BOOL ignore = [self shouldFileBeIgnored:fileURL success:&success error:error]; + return ignore && success ? GTFileIgnoreStateShouldIgnore : (!ignore && success ? GTFileIgnoreStateShouldNotIgnore : GTFileIgnoreStateIgnoreCheckFailed); +} + @end From f3cd22e12e753ecd0419d5dceb128d747f8db8f6 Mon Sep 17 00:00:00 2001 From: Ian Beck Date: Thu, 28 Jan 2016 14:33:36 -0800 Subject: [PATCH 007/228] Added offsets to git_index_entry->flags_extended comparisons, since the values are offset when provided as GTIndexEntry.flags --- ObjectiveGit/GTIndexEntry.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ObjectiveGit/GTIndexEntry.m b/ObjectiveGit/GTIndexEntry.m index 3cd401aff..a218ed398 100644 --- a/ObjectiveGit/GTIndexEntry.m +++ b/ObjectiveGit/GTIndexEntry.m @@ -86,15 +86,15 @@ - (BOOL)isStaged { } - (GTIndexEntryStatus)status { - if ((self.flags & GIT_IDXENTRY_UPDATE) != 0) { + if ((self.flags & (GIT_IDXENTRY_UPDATE << 16)) != 0) { return GTIndexEntryStatusUpdated; - } else if ((self.flags & GIT_IDXENTRY_UPTODATE) != 0) { + } else if ((self.flags & (GIT_IDXENTRY_UPTODATE << 16)) != 0) { return GTIndexEntryStatusUpToDate; - } else if ((self.flags & GIT_IDXENTRY_CONFLICTED) != 0) { + } else if ((self.flags & (GIT_IDXENTRY_CONFLICTED << 16)) != 0) { return GTIndexEntryStatusConflicted; - } else if ((self.flags & GIT_IDXENTRY_ADDED) != 0) { + } else if ((self.flags & (GIT_IDXENTRY_ADDED << 16)) != 0) { return GTIndexEntryStatusAdded; - } else if ((self.flags & GIT_IDXENTRY_REMOVE) != 0) { + } else if ((self.flags & (GIT_IDXENTRY_REMOVE << 16)) != 0) { return GTIndexEntryStatusRemoved; } From 4ad06b8f40610d1d3410eae59abb838f81c0fa83 Mon Sep 17 00:00:00 2001 From: Ian Beck Date: Thu, 28 Jan 2016 20:12:12 -0800 Subject: [PATCH 008/228] Cosmetic modifications to [GTRepository shouldIgnoreFileURL:error:] based on feedback --- ObjectiveGit/GTRepository+Status.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ObjectiveGit/GTRepository+Status.m b/ObjectiveGit/GTRepository+Status.m index bfc319091..f486668c0 100644 --- a/ObjectiveGit/GTRepository+Status.m +++ b/ObjectiveGit/GTRepository+Status.m @@ -126,9 +126,12 @@ - (BOOL)shouldFileBeIgnored:(NSURL *)fileURL success:(BOOL *)success error:(NSEr } - (GTFileIgnoreState)shouldIgnoreFileURL:(NSURL *)fileURL error:(NSError **)error { - BOOL success = false; + BOOL success = NO; BOOL ignore = [self shouldFileBeIgnored:fileURL success:&success error:error]; - return ignore && success ? GTFileIgnoreStateShouldIgnore : (!ignore && success ? GTFileIgnoreStateShouldNotIgnore : GTFileIgnoreStateIgnoreCheckFailed); + if (success) { + return (ignore ? GTFileIgnoreStateShouldIgnore : GTFileIgnoreStateShouldNotIgnore); + } + return GTFileIgnoreStateIgnoreCheckFailed; } @end From 7b18b14f436f1d60e5728ad78f3e640cbabc22c8 Mon Sep 17 00:00:00 2001 From: Ian Beck Date: Fri, 29 Jan 2016 10:00:07 -0800 Subject: [PATCH 009/228] Added tests for GTRepository.shouldFileBeIgnored:success:error: and GTRepository.shouldIgnoreFileURL:error: --- ObjectiveGitTests/GTRepository+StatusSpec.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ObjectiveGitTests/GTRepository+StatusSpec.m b/ObjectiveGitTests/GTRepository+StatusSpec.m index de7a95312..111f14a8d 100644 --- a/ObjectiveGitTests/GTRepository+StatusSpec.m +++ b/ObjectiveGitTests/GTRepository+StatusSpec.m @@ -105,6 +105,24 @@ expect(@(enumerationSuccessful)).to(beTruthy()); expect(err).to(beNil()); }); + + it(@"should report file should be ignored", ^{ + __block NSError *err = nil; + NSURL *fileURL = [repository.fileURL URLByAppendingPathComponent:@".DS_Store"]; + BOOL success = NO; + BOOL shouldIgnore = [repository shouldFileBeIgnored:fileURL success:&success error:&err]; + expect(@(success)).to(beTrue()); + expect(@(shouldIgnore)).to(beTrue()); + expect(err).to(beNil()); + }); + + it(@"should report file should be ignored (convenience wrapper)", ^{ + __block NSError *err = nil; + NSURL *fileURL = [repository.fileURL URLByAppendingPathComponent:@".DS_Store"]; + GTFileIgnoreState ignore = [repository shouldIgnoreFileURL:fileURL error:&err]; + expect(@(ignore)).to(equal(@(GTFileIgnoreStateShouldIgnore))); + expect(err).to(beNil()); + }); }); afterEach(^{ From f021ff4867e447dc5a93b45305f37f85d3a9ef92 Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Sat, 30 Jan 2016 13:07:31 +0300 Subject: [PATCH 010/228] =?UTF-8?q?+[GTDiff=20diffOldIndex:withNewIndex:?= =?UTF-8?q?=E2=80=A6]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wrapper for git_diff_index_to_index to create diffs from two in-memory indeces. --- ObjectiveGit/GTDiff.h | 17 +++++++++++++++++ ObjectiveGit/GTDiff.m | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/ObjectiveGit/GTDiff.h b/ObjectiveGit/GTDiff.h index e3ea606fb..85499e4e3 100644 --- a/ObjectiveGit/GTDiff.h +++ b/ObjectiveGit/GTDiff.h @@ -218,6 +218,23 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// Returns a newly created `GTDiff` object or nil on error. + (nullable instancetype)diffOldTree:(nullable GTTree *)oldTree withNewIndex:(nullable GTIndex *)newIndex inRepository:(GTRepository *)repository options:(nullable NSDictionary *)options error:(NSError **)error; +/// Create a diff between two `GTIndex`es. +/// +/// Both instances must be from the same repository, or an exception will be thrown. +/// +/// oldIndex - The "left" side of the diff. May be nil to represent an empty +/// index. +/// newIndex - The "right" side of the diff. May be nil to represent an empty +/// index. +/// repository - The repository to be used for the diff. Cannot be nil. +/// options - A dictionary containing any of the above options key constants, or +/// nil to use the defaults. +/// error - Populated with an `NSError` object on error, if information is +/// available. +/// +/// Returns a newly created `GTDiff` object or nil on error. ++ (nullable instancetype)diffOldIndex:(nullable GTIndex *)oldIndex withNewIndex:(nullable GTIndex *)newIndex inRepository:(GTRepository *)repository options:(nullable NSDictionary *)options error:(NSError **)error; + /// Create a diff between a repository's current index. /// /// This is equivalent to `git diff --cached ` or if you pass the HEAD diff --git a/ObjectiveGit/GTDiff.m b/ObjectiveGit/GTDiff.m index 06b09c59b..d12607acc 100644 --- a/ObjectiveGit/GTDiff.m +++ b/ObjectiveGit/GTDiff.m @@ -110,6 +110,22 @@ + (instancetype)diffOldTree:(GTTree *)oldTree withNewIndex:(GTIndex *)newIndex i return [[self alloc] initWithGitDiff:diff repository:repository]; } ++ (nullable instancetype)diffOldIndex:(GTIndex *)oldIndex withNewIndex:(GTIndex *)newIndex inRepository:(GTRepository *)repository options:(NSDictionary *)options error:(NSError **)error +{ + NSParameterAssert(repository != nil); + + __block git_diff *diff; + int status = [self handleParsedOptionsDictionary:options usingBlock:^(git_diff_options *optionsStruct) { + return git_diff_index_to_index(&diff, repository.git_repository, oldIndex.git_index, newIndex.git_index, optionsStruct); + }]; + if (status != GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:status description:@"Failed to create diff between %@ and %@", oldIndex, newIndex]; + return nil; + } + + return [[self alloc] initWithGitDiff:diff repository:repository]; +} + + (instancetype)diffIndexFromTree:(GTTree *)tree inRepository:(GTRepository *)repository options:(NSDictionary *)options error:(NSError **)error { NSParameterAssert(repository != nil); NSParameterAssert(tree == nil || [tree.repository isEqual:repository]); From 46163e20e835df0319062067f3658556a64b0b27 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sun, 31 Jan 2016 11:07:07 -0700 Subject: [PATCH 011/228] Add caveat about bitcode to readme --- README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 948707f06..e494ca854 100644 --- a/README.md +++ b/README.md @@ -26,16 +26,16 @@ The ObjectiveGit API makes extensive use of the Cocoa NSError pattern. The publi ### Xcode -ObjectiveGit requires Xcode 7 or greater to build the framework and run unit tests. Projects that must use an older version of Xcode can use +ObjectiveGit requires Xcode 7 or greater to build the framework and run unit tests. Projects that must use an older version of Xcode can use [Carthage](#carthage) to install pre-built binaries or download them [manually](#manually). ### Other Tools -To start building the framework, you must install the required dependencies, -[xctool](https://github.com/facebook/xctool) and -[cmake](https://github.com/Kitware/CMake). We recommend using -[Homebrew](http://brew.sh) to install these tools. +To start building the framework, you must install the required dependencies, +[xctool](https://github.com/facebook/xctool) and +[cmake](https://github.com/Kitware/CMake). We recommend using +[Homebrew](http://brew.sh) to install these tools. Once you have the dependencies you should clone this repository and then run [`script/bootstrap`](script/bootstrap). This will automatically pull down and install any other dependencies. @@ -52,6 +52,12 @@ There are three ways of including ObjectiveGit in a project: 1. [Manual](#manual) 1. [Subproject](#subproject) +## Bitcode + +:warning: iOS apps need to set the `ENABLE_BITCODE` build setting to `NO`. + +![Xcode project bitcode setting disabled](https://cloud.githubusercontent.com/assets/41798/10668574/d8dd3080-78d4-11e5-8aa5-e10084b7ce34.png) + ## Carthage @@ -71,7 +77,7 @@ There are three ways of including ObjectiveGit in a project: 1. **iOS targets** * On your application targets' "General" settings tab, in the "Linked Frameworks and Libraries" section, drag and drop the `ObjectiveGit.framework` from the [`Carthage/Build/iOS`](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#carthagebuild) folder on disk. ![Linked Frameworks](http://i.imgur.com/y4caRw0.png) - + * On your application targets' "Build Phases" settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script with the following contents: ``` From 0df3e1f7b5266995a3d2030ad5fbc2c7c02c82d9 Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Tue, 2 Feb 2016 17:12:15 +0300 Subject: [PATCH 012/228] Added -[GTCommit merge:error:] to quickly merge two commits together (Essentially a wrapper around git_merge_commits()) --- ObjectiveGit/GTCommit.h | 12 ++++++++++++ ObjectiveGit/GTCommit.m | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/ObjectiveGit/GTCommit.h b/ObjectiveGit/GTCommit.h index d721bf9ee..6c32d53a8 100644 --- a/ObjectiveGit/GTCommit.h +++ b/ObjectiveGit/GTCommit.h @@ -33,6 +33,7 @@ @class GTSignature; @class GTTree; @class GTOID; +@class GTIndex; NS_ASSUME_NONNULL_BEGIN @@ -54,6 +55,17 @@ NS_ASSUME_NONNULL_BEGIN /// The underlying `git_object` as a `git_commit` object. - (git_commit *)git_commit __attribute__((objc_returns_inner_pointer)); +/// Merges the given commit into the receiver in memory and produces the result as +/// an index. +/// +/// otherTree - The commit with which the receiver should be merged with. Cannot be +/// nil. +/// error - The error if one occurred. +/// +/// Returns an index which represents the result of the merge, or nil if an error +/// occurred. +- (nullable GTIndex *)merge:(GTCommit *)otherCommit error:(NSError **)error; + @end NS_ASSUME_NONNULL_END diff --git a/ObjectiveGit/GTCommit.m b/ObjectiveGit/GTCommit.m index 635134c6f..5a6e458a6 100644 --- a/ObjectiveGit/GTCommit.m +++ b/ObjectiveGit/GTCommit.m @@ -35,9 +35,11 @@ #import "NSString+Git.h" #import "NSDate+GTTimeAdditions.h" #import "GTOID.h" +#import "GTIndex.h" #import "git2/commit.h" #import "git2/errors.h" +#import "git2/merge.h" @implementation GTCommit @@ -130,4 +132,20 @@ - (NSArray *)parents { return parents; } +#pragma mark Merging + +- (GTIndex *)merge:(GTCommit *)otherCommit error:(NSError **)error { + NSParameterAssert(otherCommit != nil); + + git_index *index; + + int result = git_merge_commits(&index, self.repository.git_repository, self.git_commit, otherCommit.git_commit, NULL); + if (result != GIT_OK || index == NULL) { + if (error != NULL) *error = [NSError git_errorFor:result description:@"Failed to merge commit %@ with commit %@", self.SHA, otherCommit.SHA]; + return nil; + } + + return [[GTIndex alloc] initWithGitIndex:index repository:self.repository]; +} + @end From 79139f06e34158ea4a083d701f1aee2aa21e7691 Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Tue, 2 Feb 2016 17:19:14 +0300 Subject: [PATCH 013/228] Typo fix --- ObjectiveGit/GTCommit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTCommit.h b/ObjectiveGit/GTCommit.h index 6c32d53a8..cf4bc0373 100644 --- a/ObjectiveGit/GTCommit.h +++ b/ObjectiveGit/GTCommit.h @@ -58,7 +58,7 @@ NS_ASSUME_NONNULL_BEGIN /// Merges the given commit into the receiver in memory and produces the result as /// an index. /// -/// otherTree - The commit with which the receiver should be merged with. Cannot be +/// otherCommit - The commit with which the receiver should be merged with. Cannot be /// nil. /// error - The error if one occurred. /// From 5492126c3d35364d52d6c6e62ed6f9df10aca867 Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Wed, 3 Feb 2016 08:50:08 +0800 Subject: [PATCH 014/228] Add merge conflicted files to user info --- ObjectiveGit/GTRepository+Pull.m | 9 ++++----- ObjectiveGitTests/GTRepository+PullSpec.m | 4 +++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ObjectiveGit/GTRepository+Pull.m b/ObjectiveGit/GTRepository+Pull.m index c50810f83..2c9c36584 100644 --- a/ObjectiveGit/GTRepository+Pull.m +++ b/ObjectiveGit/GTRepository+Pull.m @@ -20,6 +20,8 @@ #import "GTIndexEntry.h" #import "git2/errors.h" +NSString * const GTPullMergeConflictedFiles = @"GTPullMergeConflictedFiles"; + @implementation GTRepository (Pull) #pragma mark - Pull @@ -112,11 +114,8 @@ - (BOOL)pullBranch:(GTBranch *)branch fromRemote:(GTRemote *)remote withOptions: [files addObject:ours.path]; }]; if (error != NULL) { - if (files.count > 0) { - *error = [NSError git_errorFor:GIT_ECONFLICT description:@"Merge conflict in files: %@. Pull aborted.", [files componentsJoinedByString:@", "]]; - } else { - *error = [NSError git_errorFor:GIT_ECONFLICT description:@"Merge conflict, pull aborted"]; - } + NSDictionary *userInfo = @{GTPullMergeConflictedFiles: files}; + *error = [NSError git_errorFor:GIT_ECONFLICT description:@"Merge conflict, Pull aborted." userInfo:userInfo failureReason:nil]; } return NO; } diff --git a/ObjectiveGitTests/GTRepository+PullSpec.m b/ObjectiveGitTests/GTRepository+PullSpec.m index 6c4dd3b78..b55291253 100644 --- a/ObjectiveGitTests/GTRepository+PullSpec.m +++ b/ObjectiveGitTests/GTRepository+PullSpec.m @@ -257,7 +257,9 @@ transferProgressed = YES; }]; expect(@(result)).to(beFalsy()); - expect(error).toNot(beNil()); + expect(error.domain).to(equal(@"GTGitErrorDomain")); + expect(error.userInfo[@"GTPullMergeConflictedFiles"]).to(equal(@[@"test.txt"])); + expect(error.localizedDescription).to(equal(@"Merge conflict, Pull aborted.")); expect(@(transferProgressed)).to(beTruthy()); }); From 8143f7fde759ad7e6024d203ac64f98a7c617d00 Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Wed, 3 Feb 2016 10:01:41 +0800 Subject: [PATCH 015/228] Expose GTPullMergeConflictedFiles key --- ObjectiveGit/GTRepository+Pull.h | 2 ++ ObjectiveGitTests/GTRepository+PullSpec.m | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ObjectiveGit/GTRepository+Pull.h b/ObjectiveGit/GTRepository+Pull.h index 63cf39a9a..fd0db84d7 100644 --- a/ObjectiveGit/GTRepository+Pull.h +++ b/ObjectiveGit/GTRepository+Pull.h @@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN +extern NSString * const GTPullMergeConflictedFiles; + /// An enum describing the result of the merge analysis. /// See `git_merge_analysis_t`. typedef NS_OPTIONS(NSInteger, GTMergeAnalysis) { diff --git a/ObjectiveGitTests/GTRepository+PullSpec.m b/ObjectiveGitTests/GTRepository+PullSpec.m index b55291253..da4e37a58 100644 --- a/ObjectiveGitTests/GTRepository+PullSpec.m +++ b/ObjectiveGitTests/GTRepository+PullSpec.m @@ -258,7 +258,7 @@ }]; expect(@(result)).to(beFalsy()); expect(error.domain).to(equal(@"GTGitErrorDomain")); - expect(error.userInfo[@"GTPullMergeConflictedFiles"]).to(equal(@[@"test.txt"])); + expect(error.userInfo[GTPullMergeConflictedFiles]).to(equal(@[@"test.txt"])); expect(error.localizedDescription).to(equal(@"Merge conflict, Pull aborted.")); expect(@(transferProgressed)).to(beTruthy()); }); From 72f149f3b3260a346c8bd02c0a6a501c5d15446f Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Wed, 3 Feb 2016 10:10:00 +0800 Subject: [PATCH 016/228] Add documentation for user info error key --- ObjectiveGit/GTRepository+Pull.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ObjectiveGit/GTRepository+Pull.h b/ObjectiveGit/GTRepository+Pull.h index fd0db84d7..de0b1f50e 100644 --- a/ObjectiveGit/GTRepository+Pull.h +++ b/ObjectiveGit/GTRepository+Pull.h @@ -11,6 +11,7 @@ NS_ASSUME_NONNULL_BEGIN +/// UserInfo key for conflicted files when pulling fails with a merge conflict extern NSString * const GTPullMergeConflictedFiles; /// An enum describing the result of the merge analysis. From 4a8802e07cdab8a16a345466af8052bae356429a Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Mon, 8 Feb 2016 17:59:30 +0300 Subject: [PATCH 017/228] Allow non modular includes in framework modules. --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 1fd8c1b1c..6cbc616b2 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -1646,7 +1646,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */; buildSettings = { - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; @@ -1671,7 +1670,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */; buildSettings = { - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; @@ -1863,7 +1861,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */; buildSettings = { - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; @@ -2096,7 +2093,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */; buildSettings = { - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; From 53e79e29a4c1e1b7861f6e6b980f95f678e2ba98 Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Mon, 8 Feb 2016 19:36:41 +0300 Subject: [PATCH 018/228] Revert "Allow non modular includes in framework modules." This reverts commit 4a8802e07cdab8a16a345466af8052bae356429a. --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 6cbc616b2..1fd8c1b1c 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -1646,6 +1646,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */; buildSettings = { + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; @@ -1670,6 +1671,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */; buildSettings = { + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; @@ -1861,6 +1863,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */; buildSettings = { + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; @@ -2093,6 +2096,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */; buildSettings = { + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; From 72fdbc75cc677b4654a1193d0b7ebf2842e50b3b Mon Sep 17 00:00:00 2001 From: Tom Booth Date: Tue, 16 Feb 2016 14:00:35 +0000 Subject: [PATCH 019/228] Fix fallback to iphonesimulator In https://github.com/libgit2/objective-git/pull/484 more flags were added into the variable `sdkflag`, which then caused the following execution of run_xctool to always fail. This means that iOS tests have not been running as part of the TravisCI run, they have only been built. You can see this if you look at the final run for the PR: https://travis-ci.org/libgit2/objective-git/builds/78334551#L192 Bash does some great things when trying to interpret variables in commands. Initially the `$sdkflag` didn't have any quotes around it as can be seen in commit 15f906ca2efa9d5ba67744d25a825c9bc75ad9e7. When the second flag was added this would have caused the command to fail because of the way Bash would interpret the whitespace. Without the surrounding quotes the command would have been executed as follows: ``` xctool -workspace ObjectiveGitFramework.xcworkspace RUN_CLANG_STATIC_ANALYZER=NO -sdk iphonesimulator -destination '"platform=iOS' Simulator,name=iPhone '5"' -scheme "ObjectiveGit iOS" test ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO ``` You can see in the above that the white space was split in the middle of the `-destination` parameter and it causes `xctool` to spout out an error. When the surrounding quotes were added it caused xctool to run but `$sdkflag` would be interpretted as a single argument, as it is executed as follows: ``` xctool -workspace ObjectiveGitFramework.xcworkspace RUN_CLANG_STATIC_ANALYZER=NO '-sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 5"' -scheme "ObjectiveGit iOS" test ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO ``` Notice in the above that the entire argument is still surrounded by single quotes. This can be solved by switching `$sdkflag` for an array of strings, this can then be correctly expanded in the command getting around the issues highlighted above. You can read more about these issues with Bash in the following links: - http://mywiki.wooledge.org/BashFAQ/050 - http://mywiki.wooledge.org/BashFAQ/073 --- script/cibuild | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/script/cibuild b/script/cibuild index 41e703068..b72816e71 100755 --- a/script/cibuild +++ b/script/cibuild @@ -118,7 +118,7 @@ build_scheme () echo "*** Building and testing $scheme..." echo - local sdkflag= + local sdkflags=() local action=test # Determine whether we can run unit tests for this target. @@ -129,17 +129,17 @@ build_scheme () if [ "$awkstatus" -eq "1" ] then # SDK not found, try for iphonesimulator. - sdkflag='-sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 5"' + sdkflags=(-sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 5") # Determine whether the unit tests will run with iphonesimulator - run_xctool "$sdkflag" -scheme "$scheme" run-tests | parse_build + run_xctool "${sdkflags[@]}" -scheme "$scheme" run-tests | parse_build awkstatus=$? if [ "$awkstatus" -ne "0" ] then # Unit tests will not run on iphonesimulator. - sdkflag="" + sdkflags=() fi fi @@ -149,7 +149,7 @@ build_scheme () action=build fi - run_xctool $sdkflag -scheme "$scheme" $action + run_xctool "${sdkflags[@]}" -scheme "$scheme" $action } export -f build_scheme From 9c13681d06decdb8de327633dc80d9b742a54423 Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Wed, 24 Feb 2016 16:23:11 +0800 Subject: [PATCH 020/228] Enable Bitcode --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 4 ---- script/update_libgit2_ios | 1 + script/update_libssh2_ios | 4 ++-- script/update_libssl_ios | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 1fd8c1b1c..5c3bdfb95 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -1908,7 +1908,6 @@ CURRENT_PROJECT_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; - ENABLE_BITCODE = NO; HEADER_SEARCH_PATHS = ( "$(inherited)", "External/libssh2-ios/include/libssh2", @@ -1973,7 +1972,6 @@ CURRENT_PROJECT_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; - ENABLE_BITCODE = NO; HEADER_SEARCH_PATHS = ( "$(inherited)", "External/libssh2-ios/include/libssh2", @@ -2006,7 +2004,6 @@ CURRENT_PROJECT_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; - ENABLE_BITCODE = NO; HEADER_SEARCH_PATHS = ( "$(inherited)", "External/libssh2-ios/include/libssh2", @@ -2039,7 +2036,6 @@ CURRENT_PROJECT_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; - ENABLE_BITCODE = NO; HEADER_SEARCH_PATHS = ( "$(inherited)", "External/libssh2-ios/include/libssh2", diff --git a/script/update_libgit2_ios b/script/update_libgit2_ios index 46029cbb8..7732f32e9 100755 --- a/script/update_libgit2_ios +++ b/script/update_libgit2_ios @@ -51,6 +51,7 @@ function build_libgit2 () -DBUILD_CLAR:BOOL=OFF \ -DTHREADSAFE:BOOL=ON \ -DCURL:BOOL=OFF \ + -DCMAKE_C_FLAGS:STRING="-fembed-bitcode" \ "${SYS_ROOT}" \ -DCMAKE_OSX_ARCHITECTURES:STRING="${ARCH}" \ .. >> "${LOG}" 2>&1 diff --git a/script/update_libssh2_ios b/script/update_libssh2_ios index 18d8a9fc2..8dd89c51c 100755 --- a/script/update_libssh2_ios +++ b/script/update_libssh2_ios @@ -24,8 +24,8 @@ function build_ssh2 () cp -R "${ROOT_PATH}/External/libssh2" "${ROOT_PATH}/External/libssh2-ios/src/" pushd "${ROOT_PATH}/External/libssh2-ios/src/libssh2" > /dev/null - export CFLAGS="-arch ${ARCH} -pipe -no-cpp-precomp -isysroot ${SDKROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}" - export CPPFLAGS="-arch ${ARCH} -pipe -no-cpp-precomp -isysroot ${SDKROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}" + export CFLAGS="-arch ${ARCH} -fembed-bitcode -pipe -no-cpp-precomp -isysroot ${SDKROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}" + export CPPFLAGS="-arch ${ARCH} -fembed-bitcode -pipe -no-cpp-precomp -isysroot ${SDKROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}" mkdir -p "${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk" LOG="${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk/build-libssh2.log" diff --git a/script/update_libssl_ios b/script/update_libssl_ios index 3d3a209dc..54c0a9a1e 100755 --- a/script/update_libssl_ios +++ b/script/update_libssl_ios @@ -43,7 +43,7 @@ function build_ssl () echo "$LOG" ./Configure ${HOST} ${CONFIG} --openssldir="/tmp/openssl-${ARCH}" >> "${LOG}" 2>&1 - perl -i -pe "s|^CC= gcc|CC= ${CLANG} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET} -arch ${ARCH} |g" Makefile >> "${LOG}" 2>&1 + perl -i -pe "s|^CC= gcc|CC= ${CLANG} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET} -arch ${ARCH} -fembed-bitcode |g" Makefile >> "${LOG}" 2>&1 perl -i -pe "s|^CFLAG= (.*)|CFLAG= -isysroot ${SDKROOT} \$1|g" Makefile >> "${LOG}" 2>&1 make >> "${LOG}" 2>&1 From 1e3f6c5bdf38c1da26c7cc2b5bd4f6b3098bca2e Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Wed, 24 Feb 2016 17:40:52 +0800 Subject: [PATCH 021/228] Add matrix build for iOS and Mac --- .travis.yml | 8 +++++++- script/cibuild | 25 ++++++++++++++++++------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index aa9d09fd7..5bc0c0ed2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,11 @@ -osx_image: xcode7 +osx_image: xcode7.2 language: objective-c +matrix: + include: + - osx_image: xcode7.2 + env: SCHEME="ObjectiveGit Mac" + - osx_image: xcode7.2 + env: SCHEME="ObjectiveGit iOS" before_install: - brew update - brew outdated xctool || brew upgrade xctool diff --git a/script/cibuild b/script/cibuild index b72816e71..19a764840 100755 --- a/script/cibuild +++ b/script/cibuild @@ -62,14 +62,19 @@ main () "$BOOTSTRAP" || exit $? fi - echo "*** Prebuilding OpenSSL" - $SCRIPT_DIR/update_libssl_ios + if [ "$SCHEME" == "ObjectiveGit iOS" ] + then + echo "*** Prebuilding OpenSSL" + $SCRIPT_DIR/update_libssl_ios + fi - echo "*** The following schemes will be built:" - echo "$SCHEMES" | xargs -n 1 echo " " - echo + if [ -z "${SCHEME+x}" ] && [ "${#SCHEME[@]}" = 0 ] + then + echo "*** The following schemes will be built:" + echo "$SCHEMES" | xargs -n 1 echo " " + echo - echo "$SCHEMES" | xargs -n 1 | ( + echo "$SCHEMES" | xargs -n 1 | ( local status=0 while read scheme @@ -78,7 +83,13 @@ main () done exit $status - ) + ) + else + echo "*** The following scheme will be built $SCHEME" + local status=0 + build_scheme "$SCHEME" || status=1 + exit $status + fi } find_pattern () From 36aff66d53f5a1823a3282d48f8b1afb63b76f8d Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Wed, 24 Feb 2016 18:12:00 +0800 Subject: [PATCH 022/228] Update Nimble, Quick to latest versions --- Cartfile.private | 4 ++-- Cartfile.resolved | 6 +++--- Carthage/Checkouts/Nimble | 2 +- Carthage/Checkouts/Quick | 2 +- Carthage/Checkouts/xcconfigs | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cartfile.private b/Cartfile.private index 0bb217bbe..951c41ff2 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,4 +1,4 @@ github "jspahrsummers/xcconfigs" >= 0.7.1 -github "Quick/Quick" ~> 0.6 -github "Quick/Nimble" ~> 2.0 +github "Quick/Quick" ~> 0.9.1 +github "Quick/Nimble" ~> 3.1 github "ZipArchive/ZipArchive" ~> 0.3 diff --git a/Cartfile.resolved b/Cartfile.resolved index 66e8355fd..642bb547b 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ -github "Quick/Nimble" "v2.0.0" -github "Quick/Quick" "v0.6.0" +github "Quick/Nimble" "v3.1.0" +github "Quick/Quick" "v0.9.1" github "ZipArchive/ZipArchive" "v0.3.3" -github "jspahrsummers/xcconfigs" "0.8.1" +github "jspahrsummers/xcconfigs" "0.9" diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble index 20a3f3b4e..72878d662 160000 --- a/Carthage/Checkouts/Nimble +++ b/Carthage/Checkouts/Nimble @@ -1 +1 @@ -Subproject commit 20a3f3b4e63cc8d97c92c4164bf36f2a2c9a6e1b +Subproject commit 72878d6622cf8362d3507cd2e3d341b06580f451 diff --git a/Carthage/Checkouts/Quick b/Carthage/Checkouts/Quick index a22e9736e..2f037560b 160000 --- a/Carthage/Checkouts/Quick +++ b/Carthage/Checkouts/Quick @@ -1 +1 @@ -Subproject commit a22e9736edf55168716dc2bb2f3256ce30061b0e +Subproject commit 2f037560be197f0f5ae992512549bc29fabb3818 diff --git a/Carthage/Checkouts/xcconfigs b/Carthage/Checkouts/xcconfigs index 99624a6af..d78854b22 160000 --- a/Carthage/Checkouts/xcconfigs +++ b/Carthage/Checkouts/xcconfigs @@ -1 +1 @@ -Subproject commit 99624a6af366c015b678a1135e4c558776a59be6 +Subproject commit d78854b22b9567e7f30d748bdd4966c86bcc93a5 From 911943369f7709d2dbf857fac27de2a5dfc56360 Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Wed, 24 Feb 2016 19:31:45 +0800 Subject: [PATCH 023/228] Update SSZipArchive --- Cartfile.private | 2 +- Cartfile.resolved | 2 +- Carthage/Checkouts/ZipArchive | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cartfile.private b/Cartfile.private index 951c41ff2..27124f747 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,4 +1,4 @@ github "jspahrsummers/xcconfigs" >= 0.7.1 github "Quick/Quick" ~> 0.9.1 github "Quick/Nimble" ~> 3.1 -github "ZipArchive/ZipArchive" ~> 0.3 +github "ZipArchive/ZipArchive" == 1.0.1 diff --git a/Cartfile.resolved b/Cartfile.resolved index 642bb547b..49f32b208 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ github "Quick/Nimble" "v3.1.0" github "Quick/Quick" "v0.9.1" -github "ZipArchive/ZipArchive" "v0.3.3" +github "ZipArchive/ZipArchive" "v1.0.1" github "jspahrsummers/xcconfigs" "0.9" diff --git a/Carthage/Checkouts/ZipArchive b/Carthage/Checkouts/ZipArchive index 28be5a67a..d2799f60a 160000 --- a/Carthage/Checkouts/ZipArchive +++ b/Carthage/Checkouts/ZipArchive @@ -1 +1 @@ -Subproject commit 28be5a67abd2aa939a2c055bf02a98e5f227ed73 +Subproject commit d2799f60a8a2332da182489c78aedbe3985b6271 From 81901e7114088830332bb35e6e7ee29f29f75333 Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Wed, 24 Feb 2016 19:31:58 +0800 Subject: [PATCH 024/228] Unzip once instead of after every test --- ObjectiveGitTests/QuickSpec+GTFixtures.m | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/ObjectiveGitTests/QuickSpec+GTFixtures.m b/ObjectiveGitTests/QuickSpec+GTFixtures.m index f5cf54fe6..1acda0381 100644 --- a/ObjectiveGitTests/QuickSpec+GTFixtures.m +++ b/ObjectiveGitTests/QuickSpec+GTFixtures.m @@ -67,8 +67,12 @@ - (void)cleanUp { #pragma mark Fixtures +- (NSString *)rootTempDirectory { + return [NSTemporaryDirectory() stringByAppendingPathComponent:@"com.libgit2.objectivegit"]; +} + - (void)setUpTempDirectoryPath { - self.tempDirectoryPath = [[NSTemporaryDirectory() stringByAppendingPathComponent:@"com.libgit2.objectivegit"] stringByAppendingPathComponent:NSProcessInfo.processInfo.globallyUniqueString]; + self.tempDirectoryPath = [self.rootTempDirectory stringByAppendingPathComponent:NSProcessInfo.processInfo.globallyUniqueString]; NSError *error = nil; BOOL success = [NSFileManager.defaultManager createDirectoryAtPath:self.tempDirectoryPath withIntermediateDirectories:YES attributes:nil error:&error]; @@ -87,9 +91,15 @@ - (void)setUpRepositoryFixtureIfNeeded:(NSString *)repositoryName { NSString *zippedRepositoriesPath = [[NSBundle bundleForClass:self.class] pathForResource:@"fixtures" ofType:@"zip"]; - error = nil; - success = [self unzipFile:repositoryName fromArchiveAtPath:zippedRepositoriesPath intoDirectory:self.repositoryFixturesPath error:&error]; - XCTAssertTrue(success, @"Couldn't unzip fixture \"%@\" from %@ to %@: %@", repositoryName, zippedRepositoriesPath, self.repositoryFixturesPath, error); + NSString *cleanRepositoryPath = [self.rootTempDirectory stringByAppendingPathComponent:@"clean_repository"]; + if (![NSFileManager.defaultManager fileExistsAtPath:cleanRepositoryPath isDirectory:nil]) { + error = nil; + success = [self unzipFile:repositoryName fromArchiveAtPath:zippedRepositoriesPath intoDirectory:cleanRepositoryPath error:&error]; + XCTAssertTrue(success, @"Couldn't unzip fixture \"%@\" from %@ to %@: %@", repositoryName, zippedRepositoriesPath, cleanRepositoryPath, error); + } + + success = [[NSFileManager defaultManager] copyItemAtPath:[cleanRepositoryPath stringByAppendingPathComponent:repositoryName] toPath:path error:&error]; + XCTAssertTrue(success, @"Couldn't copy directory %@", error); } - (NSString *)pathForFixtureRepositoryNamed:(NSString *)repositoryName { @@ -138,7 +148,8 @@ - (BOOL)unzipFile:(NSString *)member fromArchiveAtPath:(NSString *)zipPath intoD #pragma mark API - (GTRepository *)fixtureRepositoryNamed:(NSString *)name { - GTRepository *repository = [[GTRepository alloc] initWithURL:[NSURL fileURLWithPath:[self pathForFixtureRepositoryNamed:name]] error:NULL]; + NSURL *url = [NSURL fileURLWithPath:[self pathForFixtureRepositoryNamed:name]]; + GTRepository *repository = [[GTRepository alloc] initWithURL:url error:NULL]; XCTAssertNotNil(repository, @"Couldn't create a repository for %@", name); return repository; } From 35f7d08f6021d8218289a169dec7ce794e10e859 Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Wed, 24 Feb 2016 22:32:43 +0800 Subject: [PATCH 025/228] Fix pull spec mess and include in both targets --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 6 ++++-- ObjectiveGitTests/GTRepository+PullSpec.m | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 1fd8c1b1c..b6c213f4f 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -60,6 +60,8 @@ 2089E43C17D9A58000F451DA /* GTTagSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 2089E43B17D9A58000F451DA /* GTTagSpec.m */; }; 20F43DE318A2F668007D3621 /* GTRepository+Blame.h in Headers */ = {isa = PBXBuildFile; fileRef = 20F43DE118A2F667007D3621 /* GTRepository+Blame.h */; settings = {ATTRIBUTES = (Public, ); }; }; 20F43DE618A2F668007D3621 /* GTRepository+Blame.m in Sources */ = {isa = PBXBuildFile; fileRef = 20F43DE218A2F667007D3621 /* GTRepository+Blame.m */; }; + 23BB67C11C7DF60300A37A66 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; }; + 23BB67C21C7DF60400A37A66 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; }; 3011D86B1668E48500CE3409 /* GTDiffFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 3011D8691668E48500CE3409 /* GTDiffFile.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3011D86D1668E48500CE3409 /* GTDiffFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 3011D86A1668E48500CE3409 /* GTDiffFile.m */; }; 3011D8711668E78500CE3409 /* GTDiffHunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 3011D86F1668E78500CE3409 /* GTDiffHunk.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -363,7 +365,6 @@ F8D1BDF01B31FE7C00CDEC90 /* GTRepository+Pull.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */; }; F8D1BDF11B31FE7C00CDEC90 /* GTRepository+Pull.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */; }; F8E4A2911A170CA6006485A8 /* GTRemotePushSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8E4A2901A170CA6006485A8 /* GTRemotePushSpec.m */; }; - F8EFA0371B405020000FF7D0 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; }; F8EFA03A1B4059ED000FF7D0 /* GTUtilityFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0391B4059ED000FF7D0 /* GTUtilityFunctions.m */; }; /* End PBXBuildFile section */ @@ -1387,6 +1388,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 23BB67C11C7DF60300A37A66 /* GTRepository+PullSpec.m in Sources */, D0751CD918BE520400134314 /* GTFilterListSpec.m in Sources */, 200578C518932A82001C06C3 /* GTBlameSpec.m in Sources */, 4D1C40D8182C006D00BE2960 /* GTBlobSpec.m in Sources */, @@ -1408,7 +1410,6 @@ D0AC906C172F941F00347DC4 /* GTRepositorySpec.m in Sources */, D01EFDA0195DEF2200838D24 /* NSDataGitSpec.m in Sources */, 30A269AD17B4878C000FE64E /* GTRepository+StatusSpec.m in Sources */, - F8EFA0371B405020000FF7D0 /* GTRepository+PullSpec.m in Sources */, 307623AB17C6C8BD00E2CDF1 /* NSArray+StringArraySpec.m in Sources */, 8832811F173D8816006D7DCF /* GTIndexSpec.m in Sources */, D0F4E28A17C7F24200BBDE30 /* NSErrorGitSpec.m in Sources */, @@ -1555,6 +1556,7 @@ F8D007761B4F7D10009A8DAF /* GTTimeAdditionsSpec.m in Sources */, F8D007921B4FA03B009A8DAF /* GTIndexSpec.m in Sources */, F8D007711B4F7CB0009A8DAF /* NSDataGitSpec.m in Sources */, + 23BB67C21C7DF60400A37A66 /* GTRepository+PullSpec.m in Sources */, F8D007A11B4FA03B009A8DAF /* GTRepositoryStashingSpec.m in Sources */, F8D007A31B4FA03B009A8DAF /* GTFilterListSpec.m in Sources */, F8D0079D1B4FA03B009A8DAF /* GTTreeBuilderSpec.m in Sources */, diff --git a/ObjectiveGitTests/GTRepository+PullSpec.m b/ObjectiveGitTests/GTRepository+PullSpec.m index da4e37a58..ac3864ef7 100644 --- a/ObjectiveGitTests/GTRepository+PullSpec.m +++ b/ObjectiveGitTests/GTRepository+PullSpec.m @@ -68,7 +68,6 @@ [NSFileManager.defaultManager removeItemAtURL:remoteRepoURL error:NULL]; [NSFileManager.defaultManager removeItemAtURL:localRepoURL error:NULL]; error = NULL; - [self tearDown]; }); context(@"when the local and remote branches are in sync", ^{ From 3e49f0dad2fb6e1ed2739a5fc27b8a6efee0f88d Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Wed, 24 Feb 2016 23:31:08 +0800 Subject: [PATCH 026/228] Use SSZipArchive for OS X as well --- .../project.pbxproj | 39 +++++++++++++++++++ ObjectiveGitTests/QuickSpec+GTFixtures.m | 33 +--------------- 2 files changed, 41 insertions(+), 31 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index b6c213f4f..3b79f3bc6 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -60,6 +60,12 @@ 2089E43C17D9A58000F451DA /* GTTagSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 2089E43B17D9A58000F451DA /* GTTagSpec.m */; }; 20F43DE318A2F668007D3621 /* GTRepository+Blame.h in Headers */ = {isa = PBXBuildFile; fileRef = 20F43DE118A2F667007D3621 /* GTRepository+Blame.h */; settings = {ATTRIBUTES = (Public, ); }; }; 20F43DE618A2F668007D3621 /* GTRepository+Blame.m in Sources */ = {isa = PBXBuildFile; fileRef = 20F43DE218A2F667007D3621 /* GTRepository+Blame.m */; }; + 23BB67B91C7DF3B600A37A66 /* SSZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D007801B4F9758009A8DAF /* SSZipArchive.m */; }; + 23BB67BA1C7DF3BC00A37A66 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007841B4F97F9009A8DAF /* unzip.c */; }; + 23BB67BC1C7DF45300A37A66 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BB67BB1C7DF45300A37A66 /* libz.tbd */; }; + 23BB67BD1C7DF49500A37A66 /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007851B4F97F9009A8DAF /* zip.c */; }; + 23BB67BE1C7DF4B100A37A66 /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007831B4F97F9009A8DAF /* mztools.c */; }; + 23BB67BF1C7DF4CD00A37A66 /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007821B4F97F9009A8DAF /* ioapi.c */; }; 23BB67C11C7DF60300A37A66 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; }; 23BB67C21C7DF60400A37A66 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; }; 3011D86B1668E48500CE3409 /* GTDiffFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 3011D8691668E48500CE3409 /* GTDiffFile.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -445,6 +451,7 @@ 2089E43B17D9A58000F451DA /* GTTagSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTTagSpec.m; sourceTree = ""; }; 20F43DE118A2F667007D3621 /* GTRepository+Blame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTRepository+Blame.h"; sourceTree = ""; }; 20F43DE218A2F667007D3621 /* GTRepository+Blame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+Blame.m"; sourceTree = ""; }; + 23BB67BB1C7DF45300A37A66 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; 3011D8691668E48500CE3409 /* GTDiffFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTDiffFile.h; sourceTree = ""; }; 3011D86A1668E48500CE3409 /* GTDiffFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTDiffFile.m; sourceTree = ""; }; 3011D86F1668E78500CE3409 /* GTDiffHunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTDiffHunk.h; sourceTree = ""; }; @@ -649,6 +656,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 23BB67BC1C7DF45300A37A66 /* libz.tbd in Frameworks */, D0A0128A19F98475007F1914 /* Quick.framework in Frameworks */, 88F05A9E16011F6E00B7AD1D /* ObjectiveGit.framework in Frameworks */, D0A0128C19F9853D007F1914 /* Nimble.framework in Frameworks */, @@ -705,6 +713,7 @@ 0867D691FE84028FC02AAC07 /* ObjectiveGitFramework */ = { isa = PBXGroup; children = ( + 23BB67BB1C7DF45300A37A66 /* libz.tbd */, BDD8AB01130F01AB00CB5D40 /* README.md */, 887B948D1A3A38130070D41D /* ObjectiveGit.modulemap */, BDE4C05E130EFE2C00851650 /* ObjectiveGit */, @@ -1388,6 +1397,11 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 23BB67BF1C7DF4CD00A37A66 /* ioapi.c in Sources */, + 23BB67BE1C7DF4B100A37A66 /* mztools.c in Sources */, + 23BB67BD1C7DF49500A37A66 /* zip.c in Sources */, + 23BB67BA1C7DF3BC00A37A66 /* unzip.c in Sources */, + 23BB67B91C7DF3B600A37A66 /* SSZipArchive.m in Sources */, 23BB67C11C7DF60300A37A66 /* GTRepository+PullSpec.m in Sources */, D0751CD918BE520400134314 /* GTFilterListSpec.m in Sources */, 200578C518932A82001C06C3 /* GTBlameSpec.m in Sources */, @@ -1810,6 +1824,16 @@ "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "NOUNCRYPT=1", + "NOCRYPT=1", + ); + HEADER_SEARCH_PATHS = ( + External/libgit2/include, + /usr/local/include, + "Carthage/Checkouts/ZipArchive/SSZipArchive/**", + ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; @@ -1825,6 +1849,11 @@ "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", ); + HEADER_SEARCH_PATHS = ( + External/libgit2/include, + /usr/local/include, + "Carthage/Checkouts/ZipArchive/SSZipArchive/**", + ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; @@ -1894,6 +1923,11 @@ "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", ); + HEADER_SEARCH_PATHS = ( + External/libgit2/include, + /usr/local/include, + "Carthage/Checkouts/ZipArchive/SSZipArchive/**", + ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; @@ -2127,6 +2161,11 @@ "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", ); + HEADER_SEARCH_PATHS = ( + External/libgit2/include, + /usr/local/include, + "Carthage/Checkouts/ZipArchive/SSZipArchive/**", + ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; diff --git a/ObjectiveGitTests/QuickSpec+GTFixtures.m b/ObjectiveGitTests/QuickSpec+GTFixtures.m index 1acda0381..cc63e887f 100644 --- a/ObjectiveGitTests/QuickSpec+GTFixtures.m +++ b/ObjectiveGitTests/QuickSpec+GTFixtures.m @@ -9,10 +9,7 @@ #import #import "QuickSpec+GTFixtures.h" #import - -#if TARGET_OS_IPHONE #import "SSZipArchive.h" -#endif static const NSInteger FixturesErrorUnzipFailed = 666; @@ -94,7 +91,7 @@ - (void)setUpRepositoryFixtureIfNeeded:(NSString *)repositoryName { NSString *cleanRepositoryPath = [self.rootTempDirectory stringByAppendingPathComponent:@"clean_repository"]; if (![NSFileManager.defaultManager fileExistsAtPath:cleanRepositoryPath isDirectory:nil]) { error = nil; - success = [self unzipFile:repositoryName fromArchiveAtPath:zippedRepositoriesPath intoDirectory:cleanRepositoryPath error:&error]; + success = [self unzipFromArchiveAtPath:zippedRepositoriesPath intoDirectory:cleanRepositoryPath error:&error]; XCTAssertTrue(success, @"Couldn't unzip fixture \"%@\" from %@ to %@: %@", repositoryName, zippedRepositoriesPath, cleanRepositoryPath, error); } @@ -108,13 +105,7 @@ - (NSString *)pathForFixtureRepositoryNamed:(NSString *)repositoryName { return [self.repositoryFixturesPath stringByAppendingPathComponent:repositoryName]; } -- (BOOL)unzipFile:(NSString *)member fromArchiveAtPath:(NSString *)zipPath intoDirectory:(NSString *)destinationPath error:(NSError **)error { - -#if TARGET_OS_IPHONE - // iOS: unzip in-process using SSZipArchive - // - // system() and NSTask() are not available when running tests in the iOS simulator - +- (BOOL)unzipFromArchiveAtPath:(NSString *)zipPath intoDirectory:(NSString *)destinationPath error:(NSError **)error { BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:destinationPath overwrite:YES password:nil error:error]; if (!success) { @@ -123,26 +114,6 @@ - (BOOL)unzipFile:(NSString *)member fromArchiveAtPath:(NSString *)zipPath intoD } return YES; - -#else - // OS X: shell out to unzip using NSTask - - NSTask *task = [[NSTask alloc] init]; - task.launchPath = @"/usr/bin/unzip"; - task.arguments = @[ @"-qq", @"-d", destinationPath, zipPath, [member stringByAppendingString:@"*"] ]; - - [task launch]; - [task waitUntilExit]; - - BOOL success = (task.terminationStatus == 0); - if (!success) { - if (error != NULL) *error = [NSError errorWithDomain:FixturesErrorDomain code:FixturesErrorUnzipFailed userInfo:@{ NSLocalizedDescriptionKey: NSLocalizedString(@"Unzip failed", @"") }]; - } - - return success; - -#endif - } #pragma mark API From 9b092aceb2bdebec5a1ad14d6166900b783da521 Mon Sep 17 00:00:00 2001 From: Matt Diephouse Date: Wed, 24 Feb 2016 11:14:10 -0500 Subject: [PATCH 027/228] Add APIs to calculate and cleanup repository states --- ObjectiveGit/GTRepository.h | 31 +++++++++++++++++++++++ ObjectiveGit/GTRepository.m | 21 +++++++++++++++ ObjectiveGitTests/GTRepositorySpec.m | 38 ++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index 566953624..45f3caead 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -150,6 +150,20 @@ extern NSString * const GTRepositoryInitOptionsInitialHEAD; /// initialization. extern NSString * const GTRepositoryInitOptionsOriginURLString; +/// The possible states for the repository to be in, based on the current ongoing operation. +typedef NS_ENUM(NSInteger, GTRepositoryStateType) { + GTRepositoryStateNone = GIT_REPOSITORY_STATE_NONE, + GTRepositoryStateMerge = GIT_REPOSITORY_STATE_MERGE, + GTRepositoryStateRevert = GIT_REPOSITORY_STATE_REVERT, + GTRepositoryStateCherryPick = GIT_REPOSITORY_STATE_CHERRYPICK, + GTRepositoryStateBisect = GIT_REPOSITORY_STATE_BISECT, + GTRepositoryStateRebase = GIT_REPOSITORY_STATE_REBASE, + GTRepositoryStateRebaseInteractive = GIT_REPOSITORY_STATE_REBASE_INTERACTIVE, + GTRepositoryStateRebaseMerge = GIT_REPOSITORY_STATE_REBASE_MERGE, + GTRepositoryStateApplyMailbox = GIT_REPOSITORY_STATE_APPLY_MAILBOX, + GTRepositoryStateApplyMailboxOrRebase = GIT_REPOSITORY_STATE_APPLY_MAILBOX_OR_REBASE, +}; + @interface GTRepository : NSObject /// The file URL for the repository's working directory. @@ -573,6 +587,23 @@ extern NSString * const GTRepositoryInitOptionsOriginURLString; /// Returns the enumerator or nil if an error occurred. - (nullable GTEnumerator *)enumeratorForUniqueCommitsFromOID:(GTOID *)fromOID relativeToOID:(GTOID *)relativeOID error:(NSError **)error; +/// Determines the status of a git repository--i.e., whether an operation +/// (merge, cherry-pick, etc) is in progress. +/// +/// state - A pointer to set the retrieved state. Must not be NULL. +/// error - The error if one occurred. +/// +/// Returns YES if operation was successful, NO otherwise +- (BOOL)calculateState:(GTRepositoryStateType *)state withError:(NSError **)error; + +/// Remove all the metadata associated with an ongoing command like merge, +/// revert, cherry-pick, etc. For example: MERGE_HEAD, MERGE_MSG, etc. +/// +/// error - The error if one occurred. +/// +/// Returns YES if operation was successful, NO otherwise +- (BOOL)cleanupStateWithError:(NSError **)error; + @end NS_ASSUME_NONNULL_END diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 332c565f4..c2483ab57 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -898,4 +898,25 @@ - (nullable GTEnumerator *)enumeratorForUniqueCommitsFromOID:(GTOID *)fromOID re return enumerator; } +- (BOOL)calculateState:(GTRepositoryStateType *)state withError:(NSError **)error { + NSParameterAssert(state != NULL); + + int result = git_repository_state(self.git_repository); + if (result < 0) { + if (error != NULL) *error = [NSError git_errorFor:result description:@"Failed to calculate repository state"]; + return NO; + } + + *state = result; + return YES; +} + +- (BOOL)cleanupStateWithError:(NSError * _Nullable __autoreleasing *)error { + int errorCode = git_repository_state_cleanup(self.git_repository); + if (errorCode != GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:errorCode description:@"Failed to clean up repository state"]; + } + return YES; +} + @end diff --git a/ObjectiveGitTests/GTRepositorySpec.m b/ObjectiveGitTests/GTRepositorySpec.m index 4837cea71..8c7740dcc 100644 --- a/ObjectiveGitTests/GTRepositorySpec.m +++ b/ObjectiveGitTests/GTRepositorySpec.m @@ -700,6 +700,44 @@ }); }); +describe(@"-calculateState:withError:", ^{ + it(@"should find if the repository is mid-merge", ^{ + GTRepository *repository = [self conflictedFixtureRepository]; + GTRepositoryStateType state; + BOOL result; + result = [repository calculateState:&state withError:NULL]; + expect(@(result)).to(beTruthy()); + expect(@(state)).to(equal(@(GTRepositoryStateMerge))); + }); + + it(@"should return none otherwise", ^{ + GTRepository *repository = [self testAppFixtureRepository]; + GTRepositoryStateType state; + BOOL result; + result = [repository calculateState:&state withError:NULL]; + expect(@(result)).to(beTruthy()); + expect(@(state)).to(equal(@(GTRepositoryStateNone))); + }); +}); + +describe(@"-cleanupStateWithError:", ^{ + it(@"should return a repository to a pre-merge state", ^{ + GTRepository *repository = [self conflictedFixtureRepository]; + + GTRepositoryStateType state; + BOOL result; + result = [repository calculateState:&state withError:NULL]; + expect(@(result)).to(beTruthy()); + expect(@(state)).to(equal(@(GTRepositoryStateMerge))); + + expect(@([repository cleanupStateWithError:NULL])).to(beTruthy()); + + result = [repository calculateState:&state withError:NULL]; + expect(@(result)).to(beTruthy()); + expect(@(state)).to(equal(@(GTRepositoryStateNone))); + }); +}); + afterEach(^{ [self tearDown]; }); From ad0a3f52475b3b5f3bf1fe618dc480f24cbd362a Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Thu, 25 Feb 2016 00:07:18 +0800 Subject: [PATCH 028/228] Set iOS Deployment target to 9.0 in tests --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 3b79f3bc6..1493a3343 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -2268,7 +2268,7 @@ "Carthage/Checkouts/ZipArchive/SSZipArchive/**", ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( ., @@ -2320,7 +2320,7 @@ "Carthage/Checkouts/ZipArchive/SSZipArchive/**", ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( ., @@ -2373,7 +2373,7 @@ "Carthage/Checkouts/ZipArchive/SSZipArchive/**", ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( ., @@ -2426,7 +2426,7 @@ "Carthage/Checkouts/ZipArchive/SSZipArchive/**", ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( ., From a387dbd0b522c6f120bb7b6a902908b4134677b1 Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Fri, 26 Feb 2016 11:50:26 +0800 Subject: [PATCH 029/228] Remove SSZipArchive project as files are imported otherwise --- ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata | 3 --- 1 file changed, 3 deletions(-) diff --git a/ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata b/ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata index c99ffb396..f9725c4b5 100644 --- a/ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata +++ b/ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata @@ -13,7 +13,4 @@ - - From 1051e8740e92d3d8a9c008b6861fbcc007e8c392 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Thu, 25 Feb 2016 21:23:03 -0700 Subject: [PATCH 030/228] Update ZipArchive to 1.1 --- Cartfile.private | 2 +- Cartfile.resolved | 2 +- Carthage/Checkouts/ZipArchive | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cartfile.private b/Cartfile.private index 27124f747..6e6efae93 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,4 +1,4 @@ github "jspahrsummers/xcconfigs" >= 0.7.1 github "Quick/Quick" ~> 0.9.1 github "Quick/Nimble" ~> 3.1 -github "ZipArchive/ZipArchive" == 1.0.1 +github "ZipArchive/ZipArchive" ~> 1.1 diff --git a/Cartfile.resolved b/Cartfile.resolved index 49f32b208..b3fea9146 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ github "Quick/Nimble" "v3.1.0" github "Quick/Quick" "v0.9.1" -github "ZipArchive/ZipArchive" "v1.0.1" +github "ZipArchive/ZipArchive" "v1.1" github "jspahrsummers/xcconfigs" "0.9" diff --git a/Carthage/Checkouts/ZipArchive b/Carthage/Checkouts/ZipArchive index d2799f60a..057c49375 160000 --- a/Carthage/Checkouts/ZipArchive +++ b/Carthage/Checkouts/ZipArchive @@ -1 +1 @@ -Subproject commit d2799f60a8a2332da182489c78aedbe3985b6271 +Subproject commit 057c4937552f421d782e6d07ae09191b191bcc23 From baa9dd2c9f328d70705a8232b23dad3b93a453d2 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Thu, 25 Feb 2016 21:30:45 -0700 Subject: [PATCH 031/228] Consume ZipArchive framework instead of sources --- .../project.pbxproj | 38 ++++++------------- ObjectiveGitTests/QuickSpec+GTFixtures.m | 2 +- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 1493a3343..baf1cee01 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -331,11 +331,6 @@ F8D007731B4F7CC3009A8DAF /* GTSignatureSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D040AF77177B9A9E001AD9EB /* GTSignatureSpec.m */; }; F8D007741B4F7CCC009A8DAF /* GTOIDSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D040AF6F177B9779001AD9EB /* GTOIDSpec.m */; }; F8D007761B4F7D10009A8DAF /* GTTimeAdditionsSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 30B1E7FF1703871900D0814D /* GTTimeAdditionsSpec.m */; }; - F8D007811B4F9758009A8DAF /* SSZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D007801B4F9758009A8DAF /* SSZipArchive.m */; }; - F8D007861B4F97F9009A8DAF /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007821B4F97F9009A8DAF /* ioapi.c */; }; - F8D007871B4F97F9009A8DAF /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007831B4F97F9009A8DAF /* mztools.c */; }; - F8D007881B4F97F9009A8DAF /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007841B4F97F9009A8DAF /* unzip.c */; }; - F8D007891B4F97F9009A8DAF /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007851B4F97F9009A8DAF /* zip.c */; }; F8D0078B1B4F9F9E009A8DAF /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D0078A1B4F9F9E009A8DAF /* libz.dylib */; }; F8D0078C1B4FA03B009A8DAF /* GTBlobSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D1C40D7182C006D00BE2960 /* GTBlobSpec.m */; }; F8D0078D1B4FA03B009A8DAF /* GTBranchSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 88A994B916FCE7D400402C7B /* GTBranchSpec.m */; }; @@ -371,6 +366,7 @@ F8D1BDF01B31FE7C00CDEC90 /* GTRepository+Pull.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */; }; F8D1BDF11B31FE7C00CDEC90 /* GTRepository+Pull.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */; }; F8E4A2911A170CA6006485A8 /* GTRemotePushSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8E4A2901A170CA6006485A8 /* GTRemotePushSpec.m */; }; + F8E68E731C800B1600DBC517 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8E68E721C800B1600DBC517 /* ZipArchive.framework */; }; F8EFA03A1B4059ED000FF7D0 /* GTUtilityFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0391B4059ED000FF7D0 /* GTUtilityFunctions.m */; }; /* End PBXBuildFile section */ @@ -646,6 +642,7 @@ F8D1BDEC1B31FE7C00CDEC90 /* GTRepository+Pull.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTRepository+Pull.h"; sourceTree = ""; }; F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+Pull.m"; sourceTree = ""; }; F8E4A2901A170CA6006485A8 /* GTRemotePushSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTRemotePushSpec.m; sourceTree = ""; }; + F8E68E721C800B1600DBC517 /* ZipArchive.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZipArchive.framework; path = "Carthage/Checkouts/ZipArchive/build/Debug-iphoneos/ZipArchive.framework"; sourceTree = ""; }; F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+PullSpec.m"; sourceTree = ""; }; F8EFA0381B4059ED000FF7D0 /* GTUtilityFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTUtilityFunctions.h; sourceTree = ""; }; F8EFA0391B4059ED000FF7D0 /* GTUtilityFunctions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTUtilityFunctions.m; sourceTree = ""; }; @@ -693,6 +690,7 @@ F879D8471B4B8138002D5C07 /* Nimble.framework in Frameworks */, F879D8451B4B8138002D5C07 /* Quick.framework in Frameworks */, F879D83C1B4B7F7D002D5C07 /* ObjectiveGit.framework in Frameworks */, + F8E68E731C800B1600DBC517 /* ZipArchive.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -713,6 +711,7 @@ 0867D691FE84028FC02AAC07 /* ObjectiveGitFramework */ = { isa = PBXGroup; children = ( + F8E68E721C800B1600DBC517 /* ZipArchive.framework */, 23BB67BB1C7DF45300A37A66 /* libz.tbd */, BDD8AB01130F01AB00CB5D40 /* README.md */, 887B948D1A3A38130070D41D /* ObjectiveGit.modulemap */, @@ -1603,11 +1602,6 @@ F8D007961B4FA03B009A8DAF /* GTRemotePushSpec.m in Sources */, F8D007A51B4FA03B009A8DAF /* GTDiffDeltaSpec.m in Sources */, F879D8481B4B83B9002D5C07 /* SwiftSpec.swift in Sources */, - F8D007811B4F9758009A8DAF /* SSZipArchive.m in Sources */, - F8D007861B4F97F9009A8DAF /* ioapi.c in Sources */, - F8D007871B4F97F9009A8DAF /* mztools.c in Sources */, - F8D007881B4F97F9009A8DAF /* unzip.c in Sources */, - F8D007891B4F97F9009A8DAF /* zip.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2244,6 +2238,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", + "$(SRCROOT)/Carthage/Build/iOS", ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; @@ -2263,10 +2258,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "Carthage/Checkouts/ZipArchive/SSZipArchive/**", - ); + HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -2305,6 +2297,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", + "$(SRCROOT)/Carthage/Build/iOS", ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -2315,10 +2308,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "Carthage/Checkouts/ZipArchive/SSZipArchive/**", - ); + HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -2358,6 +2348,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", + "$(SRCROOT)/Carthage/Build/iOS", ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -2368,10 +2359,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "Carthage/Checkouts/ZipArchive/SSZipArchive/**", - ); + HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -2411,6 +2399,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", + "$(SRCROOT)/Carthage/Build/iOS", ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -2421,10 +2410,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "Carthage/Checkouts/ZipArchive/SSZipArchive/**", - ); + HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; diff --git a/ObjectiveGitTests/QuickSpec+GTFixtures.m b/ObjectiveGitTests/QuickSpec+GTFixtures.m index cc63e887f..9d7302e65 100644 --- a/ObjectiveGitTests/QuickSpec+GTFixtures.m +++ b/ObjectiveGitTests/QuickSpec+GTFixtures.m @@ -9,7 +9,7 @@ #import #import "QuickSpec+GTFixtures.h" #import -#import "SSZipArchive.h" +#import static const NSInteger FixturesErrorUnzipFailed = 666; From 6cab7e21b366b377f0e912d3578e4dc05eadb22e Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Thu, 25 Feb 2016 21:32:44 -0700 Subject: [PATCH 032/228] Remove unused frameworks folder path Gets rid of warning: Directory not found for option '-F/Applications/Xcode7.2.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/Developer/Library/Frameworks' --- .../project.pbxproj | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index baf1cee01..01220b10d 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -2235,11 +2235,7 @@ COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(SRCROOT)/Carthage/Build/iOS", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -2294,11 +2290,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(SRCROOT)/Carthage/Build/iOS", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; @@ -2345,11 +2337,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(SRCROOT)/Carthage/Build/iOS", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; @@ -2396,11 +2384,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(SRCROOT)/Carthage/Build/iOS", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; From 9d483d8a37725833570487425c470a24d46448ba Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Thu, 25 Feb 2016 21:44:54 -0700 Subject: [PATCH 033/228] Add ZipArchive project reference This causes Xcode to build the framework as needed so it doesn't need to be prebuilt using carthage --- ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata b/ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata index f9725c4b5..d37216e50 100644 --- a/ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata +++ b/ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata @@ -13,4 +13,7 @@ + + From ef17121be8a14a93d52e73fc198f7ecf1d7a52e7 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Thu, 25 Feb 2016 22:50:30 -0700 Subject: [PATCH 034/228] Use ZipArchive.framework for Mac Tests too --- .../project.pbxproj | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 01220b10d..e62fc83b0 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -60,12 +60,7 @@ 2089E43C17D9A58000F451DA /* GTTagSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 2089E43B17D9A58000F451DA /* GTTagSpec.m */; }; 20F43DE318A2F668007D3621 /* GTRepository+Blame.h in Headers */ = {isa = PBXBuildFile; fileRef = 20F43DE118A2F667007D3621 /* GTRepository+Blame.h */; settings = {ATTRIBUTES = (Public, ); }; }; 20F43DE618A2F668007D3621 /* GTRepository+Blame.m in Sources */ = {isa = PBXBuildFile; fileRef = 20F43DE218A2F667007D3621 /* GTRepository+Blame.m */; }; - 23BB67B91C7DF3B600A37A66 /* SSZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D007801B4F9758009A8DAF /* SSZipArchive.m */; }; - 23BB67BA1C7DF3BC00A37A66 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007841B4F97F9009A8DAF /* unzip.c */; }; 23BB67BC1C7DF45300A37A66 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BB67BB1C7DF45300A37A66 /* libz.tbd */; }; - 23BB67BD1C7DF49500A37A66 /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007851B4F97F9009A8DAF /* zip.c */; }; - 23BB67BE1C7DF4B100A37A66 /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007831B4F97F9009A8DAF /* mztools.c */; }; - 23BB67BF1C7DF4CD00A37A66 /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007821B4F97F9009A8DAF /* ioapi.c */; }; 23BB67C11C7DF60300A37A66 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; }; 23BB67C21C7DF60400A37A66 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; }; 3011D86B1668E48500CE3409 /* GTDiffFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 3011D8691668E48500CE3409 /* GTDiffFile.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -325,6 +320,7 @@ F879D8451B4B8138002D5C07 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0A0128819F98475007F1914 /* Quick.framework */; }; F879D8471B4B8138002D5C07 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F879D8461B4B8138002D5C07 /* Nimble.framework */; }; F879D8481B4B83B9002D5C07 /* SwiftSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0A0129619F9A660007F1914 /* SwiftSpec.swift */; }; + F895F4DF1C801E5F004EA221 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F895F4DE1C801E5F004EA221 /* ZipArchive.framework */; }; F8D007701B4F7CA8009A8DAF /* NSErrorGitSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F4E28917C7F24200BBDE30 /* NSErrorGitSpec.m */; }; F8D007711B4F7CB0009A8DAF /* NSDataGitSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D01EFD9F195DEF2200838D24 /* NSDataGitSpec.m */; }; F8D007721B4F7CB6009A8DAF /* NSArray+StringArraySpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 307623AA17C6C8BD00E2CDF1 /* NSArray+StringArraySpec.m */; }; @@ -633,6 +629,7 @@ F879D82F1B4B77F4002D5C07 /* Libgit2FeaturesSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Libgit2FeaturesSpec.m; sourceTree = ""; }; F879D8361B4B7F7C002D5C07 /* ObjectiveGit-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ObjectiveGit-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; F879D8461B4B8138002D5C07 /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = "Carthage/Checkouts/Nimble/build/Debug-iphoneos/Nimble.framework"; sourceTree = ""; }; + F895F4DE1C801E5F004EA221 /* ZipArchive.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZipArchive.framework; path = "/Volumes/DerivedData/ObjectiveGitFramework-drtqacfhlqybdcdpqayztrrwneun/Build/Products/Debug/ZipArchive.framework"; sourceTree = ""; }; F8D007801B4F9758009A8DAF /* SSZipArchive.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SSZipArchive.m; path = Carthage/Checkouts/ZipArchive/SSZipArchive/SSZipArchive.m; sourceTree = ""; }; F8D007821B4F97F9009A8DAF /* ioapi.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = ioapi.c; path = Carthage/Checkouts/ZipArchive/SSZipArchive/minizip/ioapi.c; sourceTree = ""; }; F8D007831B4F97F9009A8DAF /* mztools.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = mztools.c; path = Carthage/Checkouts/ZipArchive/SSZipArchive/minizip/mztools.c; sourceTree = ""; }; @@ -657,6 +654,7 @@ D0A0128A19F98475007F1914 /* Quick.framework in Frameworks */, 88F05A9E16011F6E00B7AD1D /* ObjectiveGit.framework in Frameworks */, D0A0128C19F9853D007F1914 /* Nimble.framework in Frameworks */, + F895F4DF1C801E5F004EA221 /* ZipArchive.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -711,8 +709,6 @@ 0867D691FE84028FC02AAC07 /* ObjectiveGitFramework */ = { isa = PBXGroup; children = ( - F8E68E721C800B1600DBC517 /* ZipArchive.framework */, - 23BB67BB1C7DF45300A37A66 /* libz.tbd */, BDD8AB01130F01AB00CB5D40 /* README.md */, 887B948D1A3A38130070D41D /* ObjectiveGit.modulemap */, BDE4C05E130EFE2C00851650 /* ObjectiveGit */, @@ -736,6 +732,7 @@ 8803DA861313145700E6E818 /* libz.dylib */, F8D0078A1B4F9F9E009A8DAF /* libz.dylib */, 884C8A3619FF4B4D0017E98D /* libz.dylib */, + 23BB67BB1C7DF45300A37A66 /* libz.tbd */, 884C8A3819FF4B6D0017E98D /* libiconv.dylib */, 6A1F2FD317C6A8F3003DFADE /* libcrypto.a */, 6A1F2FD417C6A8F3003DFADE /* libssl.a */, @@ -746,6 +743,8 @@ D0A0128B19F9853D007F1914 /* Nimble.framework */, F879D8461B4B8138002D5C07 /* Nimble.framework */, 889923F919FF5DD40092A9A6 /* git2 */, + F895F4DE1C801E5F004EA221 /* ZipArchive.framework */, + F8E68E721C800B1600DBC517 /* ZipArchive.framework */, ); name = "External Frameworks and Libraries"; sourceTree = ""; @@ -1396,11 +1395,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 23BB67BF1C7DF4CD00A37A66 /* ioapi.c in Sources */, - 23BB67BE1C7DF4B100A37A66 /* mztools.c in Sources */, - 23BB67BD1C7DF49500A37A66 /* zip.c in Sources */, - 23BB67BA1C7DF3BC00A37A66 /* unzip.c in Sources */, - 23BB67B91C7DF3B600A37A66 /* SSZipArchive.m in Sources */, 23BB67C11C7DF60300A37A66 /* GTRepository+PullSpec.m in Sources */, D0751CD918BE520400134314 /* GTFilterListSpec.m in Sources */, 200578C518932A82001C06C3 /* GTBlameSpec.m in Sources */, @@ -1826,7 +1820,6 @@ HEADER_SEARCH_PATHS = ( External/libgit2/include, /usr/local/include, - "Carthage/Checkouts/ZipArchive/SSZipArchive/**", ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.9; @@ -1846,7 +1839,6 @@ HEADER_SEARCH_PATHS = ( External/libgit2/include, /usr/local/include, - "Carthage/Checkouts/ZipArchive/SSZipArchive/**", ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.9; @@ -1920,7 +1912,6 @@ HEADER_SEARCH_PATHS = ( External/libgit2/include, /usr/local/include, - "Carthage/Checkouts/ZipArchive/SSZipArchive/**", ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.9; @@ -2158,7 +2149,6 @@ HEADER_SEARCH_PATHS = ( External/libgit2/include, /usr/local/include, - "Carthage/Checkouts/ZipArchive/SSZipArchive/**", ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.9; From 834d8b7f54258f4d05707f0f193167429521da47 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Thu, 25 Feb 2016 22:50:53 -0700 Subject: [PATCH 035/228] Remove obsolete SSZipArchive group --- .../project.pbxproj | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index e62fc83b0..83ac06027 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -630,11 +630,6 @@ F879D8361B4B7F7C002D5C07 /* ObjectiveGit-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ObjectiveGit-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; F879D8461B4B8138002D5C07 /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = "Carthage/Checkouts/Nimble/build/Debug-iphoneos/Nimble.framework"; sourceTree = ""; }; F895F4DE1C801E5F004EA221 /* ZipArchive.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZipArchive.framework; path = "/Volumes/DerivedData/ObjectiveGitFramework-drtqacfhlqybdcdpqayztrrwneun/Build/Products/Debug/ZipArchive.framework"; sourceTree = ""; }; - F8D007801B4F9758009A8DAF /* SSZipArchive.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SSZipArchive.m; path = Carthage/Checkouts/ZipArchive/SSZipArchive/SSZipArchive.m; sourceTree = ""; }; - F8D007821B4F97F9009A8DAF /* ioapi.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = ioapi.c; path = Carthage/Checkouts/ZipArchive/SSZipArchive/minizip/ioapi.c; sourceTree = ""; }; - F8D007831B4F97F9009A8DAF /* mztools.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = mztools.c; path = Carthage/Checkouts/ZipArchive/SSZipArchive/minizip/mztools.c; sourceTree = ""; }; - F8D007841B4F97F9009A8DAF /* unzip.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = unzip.c; path = Carthage/Checkouts/ZipArchive/SSZipArchive/minizip/unzip.c; sourceTree = ""; }; - F8D007851B4F97F9009A8DAF /* zip.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = zip.c; path = Carthage/Checkouts/ZipArchive/SSZipArchive/minizip/zip.c; sourceTree = ""; }; F8D0078A1B4F9F9E009A8DAF /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; }; F8D1BDEC1B31FE7C00CDEC90 /* GTRepository+Pull.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTRepository+Pull.h"; sourceTree = ""; }; F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+Pull.m"; sourceTree = ""; }; @@ -801,7 +796,6 @@ 88F05A7516011E5400B7AD1D /* ObjectiveGitTests */ = { isa = PBXGroup; children = ( - F84E92581B8B6EA30019F947 /* SSZipArchive */, 200578C418932A82001C06C3 /* GTBlameSpec.m */, 4D1C40D7182C006D00BE2960 /* GTBlobSpec.m */, 88A994B916FCE7D400402C7B /* GTBranchSpec.m */, @@ -1043,19 +1037,6 @@ path = Scripts; sourceTree = ""; }; - F84E92581B8B6EA30019F947 /* SSZipArchive */ = { - isa = PBXGroup; - children = ( - F8D007801B4F9758009A8DAF /* SSZipArchive.m */, - F8D007821B4F97F9009A8DAF /* ioapi.c */, - F8D007831B4F97F9009A8DAF /* mztools.c */, - F8D007841B4F97F9009A8DAF /* unzip.c */, - F8D007851B4F97F9009A8DAF /* zip.c */, - ); - name = SSZipArchive; - path = ..; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ From ab423688ba96eddc8855b6f0842ff86b5510c6fd Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 26 Feb 2016 06:25:32 -0700 Subject: [PATCH 036/228] Remove bitcode caveat --- README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README.md b/README.md index e494ca854..95afc81f5 100644 --- a/README.md +++ b/README.md @@ -52,16 +52,9 @@ There are three ways of including ObjectiveGit in a project: 1. [Manual](#manual) 1. [Subproject](#subproject) -## Bitcode - -:warning: iOS apps need to set the `ENABLE_BITCODE` build setting to `NO`. - -![Xcode project bitcode setting disabled](https://cloud.githubusercontent.com/assets/41798/10668574/d8dd3080-78d4-11e5-8aa5-e10084b7ce34.png) - ## Carthage - 1. Add ObjectiveGit to your [`Cartfile`](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile). ``` From eb64dc49fc5e16efceb82f8e5fd44fe844139ecb Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Sat, 27 Feb 2016 13:55:50 +0800 Subject: [PATCH 037/228] Remove custom deployment target for tests --- .../project.pbxproj | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 1493a3343..778df49fd 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -2241,10 +2241,6 @@ COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -2268,7 +2264,6 @@ "Carthage/Checkouts/ZipArchive/SSZipArchive/**", ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( ., @@ -2302,10 +2297,6 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; @@ -2320,7 +2311,6 @@ "Carthage/Checkouts/ZipArchive/SSZipArchive/**", ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( ., @@ -2355,10 +2345,6 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; @@ -2373,7 +2359,6 @@ "Carthage/Checkouts/ZipArchive/SSZipArchive/**", ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( ., @@ -2408,10 +2393,6 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; @@ -2426,7 +2407,6 @@ "Carthage/Checkouts/ZipArchive/SSZipArchive/**", ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( ., From 2dc7d720c6438151335ad00fa6383e3aca351c4e Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Mon, 29 Feb 2016 11:03:46 +0800 Subject: [PATCH 038/228] Revert changes in project file --- .../project.pbxproj | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 778df49fd..1493a3343 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -2241,6 +2241,10 @@ COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -2264,6 +2268,7 @@ "Carthage/Checkouts/ZipArchive/SSZipArchive/**", ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( ., @@ -2297,6 +2302,10 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; @@ -2311,6 +2320,7 @@ "Carthage/Checkouts/ZipArchive/SSZipArchive/**", ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( ., @@ -2345,6 +2355,10 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; @@ -2359,6 +2373,7 @@ "Carthage/Checkouts/ZipArchive/SSZipArchive/**", ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( ., @@ -2393,6 +2408,10 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; @@ -2407,6 +2426,7 @@ "Carthage/Checkouts/ZipArchive/SSZipArchive/**", ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( ., From de7f6440a1a8b39c4dd679344bcb82dd8775a7b8 Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Mon, 29 Feb 2016 11:03:55 +0800 Subject: [PATCH 039/228] Use Xcode 7 --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5bc0c0ed2..3f53414e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ -osx_image: xcode7.2 +osx_image: xcode7 language: objective-c matrix: include: - - osx_image: xcode7.2 + - osx_image: xcode7 env: SCHEME="ObjectiveGit Mac" - - osx_image: xcode7.2 + - osx_image: xcode7 env: SCHEME="ObjectiveGit iOS" before_install: - brew update From 74f9dc54ce45f5540e6dbaccfd154db8afe3cb8c Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Wed, 2 Mar 2016 16:47:55 +0800 Subject: [PATCH 040/228] Add enumerating merge head entries --- ObjectiveGit/GTRepository+Merging.h | 34 +++++++++ ObjectiveGit/GTRepository+Merging.m | 70 +++++++++++++++++++ ObjectiveGit/GTRepository+Pull.m | 4 ++ ObjectiveGit/ObjectiveGit.h | 1 + .../project.pbxproj | 12 ++++ 5 files changed, 121 insertions(+) create mode 100644 ObjectiveGit/GTRepository+Merging.h create mode 100644 ObjectiveGit/GTRepository+Merging.m diff --git a/ObjectiveGit/GTRepository+Merging.h b/ObjectiveGit/GTRepository+Merging.h new file mode 100644 index 000000000..57013183c --- /dev/null +++ b/ObjectiveGit/GTRepository+Merging.h @@ -0,0 +1,34 @@ +// +// GTRepository+Merging.h +// ObjectiveGitFramework +// +// Created by Piet Brauer on 02/03/16. +// Copyright © 2016 GitHub, Inc. All rights reserved. +// + +#import "GTRepository.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface GTRepository (Merging) + +/// Enumerate all available merge head entries. +/// +/// error - The error if one ocurred. Can be NULL. +/// block - A block to execute for each MERGE_HEAD entry. `mergeHeadEntry` will +/// be the current merge head entry. Setting `stop` to YES will cause +/// enumeration to stop after the block returns. Must not be nil. +/// +/// Returns YES if the operation succedded, NO otherwise. +- (BOOL)enumerateMergeHeadEntriesWithError:(NSError **)error usingBlock:(void (^)(GTCommit *mergeHeadEntry, BOOL *stop))block; + +/// Convenience method for -enumerateMergeHeadEntriesWithError:usingBlock: that retuns an NSArray with all the fetch head entries. +/// +/// error - The error if one ocurred. Can be NULL. +/// +/// Retruns a (possibly empty) array with GTCommit objects. Will not be nil. +- (NSArray *)mergeHeadEntriesWithError:(NSError **)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ObjectiveGit/GTRepository+Merging.m b/ObjectiveGit/GTRepository+Merging.m new file mode 100644 index 000000000..0acbc095e --- /dev/null +++ b/ObjectiveGit/GTRepository+Merging.m @@ -0,0 +1,70 @@ +// +// GTRepository+Merging.m +// ObjectiveGitFramework +// +// Created by Piet Brauer on 02/03/16. +// Copyright © 2016 GitHub, Inc. All rights reserved. +// + +#import "GTRepository+Merging.h" +#import "GTOID.h" +#import "NSError+Git.h" +#import "git2/errors.h" + +typedef void (^GTRemoteFetchTransferProgressBlock)(const git_transfer_progress *stats, BOOL *stop); + +@implementation GTRepository (Merging) + +typedef void (^GTRepositoryEnumerateMergeHeadEntryBlock)(GTCommit *entry, BOOL *stop); + +typedef struct { + __unsafe_unretained GTRepository *repository; + __unsafe_unretained GTRepositoryEnumerateMergeHeadEntryBlock enumerationBlock; +} GTEnumerateMergeHeadEntriesPayload; + +int GTMergeHeadEntriesCallback(const git_oid *oid, void *payload) { + GTEnumerateMergeHeadEntriesPayload *entriesPayload = payload; + + GTRepository *repository = entriesPayload->repository; + GTRepositoryEnumerateMergeHeadEntryBlock enumerationBlock = entriesPayload->enumerationBlock; + + GTCommit *commit = [repository lookUpObjectByOID:[GTOID oidWithGitOid:oid] objectType:GTObjectTypeCommit error:NULL]; + + BOOL stop = NO; + + enumerationBlock(commit, &stop); + + return (stop == YES ? GIT_EUSER : 0); +} + +- (BOOL)enumerateMergeHeadEntriesWithError:(NSError **)error usingBlock:(void (^)(GTCommit *mergeHeadEntry, BOOL *stop))block { + NSParameterAssert(block != nil); + + GTEnumerateMergeHeadEntriesPayload payload = { + .repository = self, + .enumerationBlock = block, + }; + + int gitError = git_repository_mergehead_foreach(self.git_repository, GTMergeHeadEntriesCallback, &payload); + + if (gitError != GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to get mergehead entries"]; + return NO; + } + + return YES; +} + +- (NSArray *)mergeHeadEntriesWithError:(NSError **)error { + NSMutableArray *entries = [NSMutableArray array]; + + [self enumerateMergeHeadEntriesWithError:error usingBlock:^(GTCommit *mergeHeadEntry, BOOL *stop) { + [entries addObject:mergeHeadEntry]; + + *stop = NO; + }]; + + return entries; +} + +@end diff --git a/ObjectiveGit/GTRepository+Pull.m b/ObjectiveGit/GTRepository+Pull.m index 2c9c36584..25c517bbe 100644 --- a/ObjectiveGit/GTRepository+Pull.m +++ b/ObjectiveGit/GTRepository+Pull.m @@ -112,6 +112,10 @@ - (BOOL)pullBranch:(GTBranch *)branch fromRemote:(GTRemote *)remote withOptions: NSMutableArray *files = [NSMutableArray array]; [index enumerateConflictedFilesWithError:error usingBlock:^(GTIndexEntry * _Nonnull ancestor, GTIndexEntry * _Nonnull ours, GTIndexEntry * _Nonnull theirs, BOOL * _Nonnull stop) { [files addObject:ours.path]; + + GTMergeFileResult *result = [index mergeIndexEntries:ancestor ours:ours theirs:theirs error:error]; + NSURL *oursFileURL = [self.fileURL URLByAppendingPathComponent:result.path]; + [result.contents writeToURL:oursFileURL atomically:YES encoding:NSUTF8StringEncoding error:error]; }]; if (error != NULL) { NSDictionary *userInfo = @{GTPullMergeConflictedFiles: files}; diff --git a/ObjectiveGit/ObjectiveGit.h b/ObjectiveGit/ObjectiveGit.h index ef8126cb3..8054e3878 100644 --- a/ObjectiveGit/ObjectiveGit.h +++ b/ObjectiveGit/ObjectiveGit.h @@ -41,6 +41,7 @@ FOUNDATION_EXPORT const unsigned char ObjectiveGitVersionString[]; #import #import #import +#import #import #import #import diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 0f5b34ef5..5834b6b40 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -63,6 +63,10 @@ 23BB67BC1C7DF45300A37A66 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BB67BB1C7DF45300A37A66 /* libz.tbd */; }; 23BB67C11C7DF60300A37A66 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; }; 23BB67C21C7DF60400A37A66 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; }; + 23F39FAD1C86DB1C00849F3C /* GTRepository+Merging.h in Headers */ = {isa = PBXBuildFile; fileRef = 23F39FAB1C86DB1C00849F3C /* GTRepository+Merging.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 23F39FAE1C86DB1C00849F3C /* GTRepository+Merging.m in Sources */ = {isa = PBXBuildFile; fileRef = 23F39FAC1C86DB1C00849F3C /* GTRepository+Merging.m */; }; + 23F39FAF1C86DD0A00849F3C /* GTRepository+Merging.h in Headers */ = {isa = PBXBuildFile; fileRef = 23F39FAB1C86DB1C00849F3C /* GTRepository+Merging.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 23F39FB01C86E01800849F3C /* GTRepository+Merging.m in Sources */ = {isa = PBXBuildFile; fileRef = 23F39FAC1C86DB1C00849F3C /* GTRepository+Merging.m */; }; 3011D86B1668E48500CE3409 /* GTDiffFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 3011D8691668E48500CE3409 /* GTDiffFile.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3011D86D1668E48500CE3409 /* GTDiffFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 3011D86A1668E48500CE3409 /* GTDiffFile.m */; }; 3011D8711668E78500CE3409 /* GTDiffHunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 3011D86F1668E78500CE3409 /* GTDiffHunk.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -444,6 +448,8 @@ 20F43DE118A2F667007D3621 /* GTRepository+Blame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTRepository+Blame.h"; sourceTree = ""; }; 20F43DE218A2F667007D3621 /* GTRepository+Blame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+Blame.m"; sourceTree = ""; }; 23BB67BB1C7DF45300A37A66 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; + 23F39FAB1C86DB1C00849F3C /* GTRepository+Merging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTRepository+Merging.h"; sourceTree = ""; }; + 23F39FAC1C86DB1C00849F3C /* GTRepository+Merging.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+Merging.m"; sourceTree = ""; }; 3011D8691668E48500CE3409 /* GTDiffFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTDiffFile.h; sourceTree = ""; }; 3011D86A1668E48500CE3409 /* GTDiffFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTDiffFile.m; sourceTree = ""; }; 3011D86F1668E78500CE3409 /* GTDiffHunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTDiffHunk.h; sourceTree = ""; }; @@ -875,6 +881,8 @@ 4DFFB15A183AA8D600D1565E /* GTRepository+RemoteOperations.m */, 88B2131A1B20E785005CF2C5 /* GTRepository+References.h */, 88B2131B1B20E785005CF2C5 /* GTRepository+References.m */, + 23F39FAB1C86DB1C00849F3C /* GTRepository+Merging.h */, + 23F39FAC1C86DB1C00849F3C /* GTRepository+Merging.m */, BDD8AE6D13131B8800CB5D40 /* GTEnumerator.h */, BDD8AE6E13131B8800CB5D40 /* GTEnumerator.m */, BD6C22A71314625800992935 /* GTObject.h */, @@ -1072,6 +1080,7 @@ 79262F8B13C69B1600A4B1EA /* git2.h in Headers */, 88EB7E4D14AEBA600046FEA4 /* GTConfiguration.h in Headers */, BDE4C064130EFE2C00851650 /* NSError+Git.h in Headers */, + 23F39FAD1C86DB1C00849F3C /* GTRepository+Merging.h in Headers */, 55C8057D13875C11004DCB0F /* NSData+Git.h in Headers */, D03B57A118BFFF07007124F4 /* GTDiffPatch.h in Headers */, 883CD6AB1600EBC600F57354 /* GTRemote.h in Headers */, @@ -1108,6 +1117,7 @@ D01B6F2319F82F8700D411BC /* GTRepository+Reset.h in Headers */, D01B6F2D19F82F8700D411BC /* GTEnumerator.h in Headers */, D01B6F5519F82FA600D411BC /* GTReflog.h in Headers */, + 23F39FAF1C86DD0A00849F3C /* GTRepository+Merging.h in Headers */, D01B6F3519F82F8700D411BC /* GTBlob.h in Headers */, D01B6F4D19F82F8700D411BC /* GTRemote.h in Headers */, D01B6F1519F82F7B00D411BC /* NSData+Git.h in Headers */, @@ -1427,6 +1437,7 @@ BDD8AE7013131B8800CB5D40 /* GTEnumerator.m in Sources */, BD6C235313146E6600992935 /* GTCommit.m in Sources */, 30DCBA5E17B45213009B0EBD /* GTStatusDelta.m in Sources */, + 23F39FAE1C86DB1C00849F3C /* GTRepository+Merging.m in Sources */, 30DCBA6517B45A78009B0EBD /* GTRepository+Status.m in Sources */, BD6C235413146E6A00992935 /* GTObject.m in Sources */, BD6C254613148DD300992935 /* GTSignature.m in Sources */, @@ -1486,6 +1497,7 @@ D01B6F2E19F82F8700D411BC /* GTEnumerator.m in Sources */, D01B6F4C19F82F8700D411BC /* GTConfiguration.m in Sources */, D01B6F6619F82FA600D411BC /* GTRepository+Attributes.m in Sources */, + 23F39FB01C86E01800849F3C /* GTRepository+Merging.m in Sources */, D019778A19F8307600F523DA /* ObjectiveGit.m in Sources */, D01B6F3219F82F8700D411BC /* GTCommit.m in Sources */, D01B6F3819F82F8700D411BC /* GTTree.m in Sources */, From 000b9d526dcf831c64e33bcf163da142b9a4064b Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Wed, 2 Mar 2016 17:55:46 +0800 Subject: [PATCH 041/228] =?UTF-8?q?Write=20merge=20conflicted=20files=20th?= =?UTF-8?q?e=20right=20way=E2=84=A2=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ObjectiveGit/GTRepository+Pull.m | 35 ++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/ObjectiveGit/GTRepository+Pull.m b/ObjectiveGit/GTRepository+Pull.m index 25c517bbe..3e39530fc 100644 --- a/ObjectiveGit/GTRepository+Pull.m +++ b/ObjectiveGit/GTRepository+Pull.m @@ -112,15 +112,23 @@ - (BOOL)pullBranch:(GTBranch *)branch fromRemote:(GTRemote *)remote withOptions: NSMutableArray *files = [NSMutableArray array]; [index enumerateConflictedFilesWithError:error usingBlock:^(GTIndexEntry * _Nonnull ancestor, GTIndexEntry * _Nonnull ours, GTIndexEntry * _Nonnull theirs, BOOL * _Nonnull stop) { [files addObject:ours.path]; - - GTMergeFileResult *result = [index mergeIndexEntries:ancestor ours:ours theirs:theirs error:error]; - NSURL *oursFileURL = [self.fileURL URLByAppendingPathComponent:result.path]; - [result.contents writeToURL:oursFileURL atomically:YES encoding:NSUTF8StringEncoding error:error]; }]; + if (error != NULL) { NSDictionary *userInfo = @{GTPullMergeConflictedFiles: files}; *error = [NSError git_errorFor:GIT_ECONFLICT description:@"Merge conflict, Pull aborted." userInfo:userInfo failureReason:nil]; } + + // Write conflicts + git_merge_options merge_opts = GIT_MERGE_OPTIONS_INIT; + git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT; + checkout_opts.checkout_strategy = GIT_CHECKOUT_ALLOW_CONFLICTS; + + git_annotated_commit *annotatedCommit; + [self annotatedCommit:&annotatedCommit fromCommit:remoteCommit error:error]; + + git_merge(repo.git_repository, (const git_annotated_commit **)&annotatedCommit, 1, &merge_opts, &checkout_opts); + return NO; } @@ -146,6 +154,16 @@ - (BOOL)pullBranch:(GTBranch *)branch fromRemote:(GTRemote *)remote withOptions: return NO; } +- (BOOL)annotatedCommit:(git_annotated_commit **)annotatedCommit fromCommit:(GTCommit *)fromCommit error:(NSError **)error { + int gitError = git_annotated_commit_lookup(annotatedCommit, self.git_repository, fromCommit.OID.git_oid); + if (gitError != GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to lookup annotated commit for %@", fromCommit]; + return NO; + } + + return YES; +} + - (BOOL)analyzeMerge:(GTMergeAnalysis *)analysis fromBranch:(GTBranch *)fromBranch error:(NSError **)error { NSParameterAssert(analysis != NULL); NSParameterAssert(fromBranch != nil); @@ -156,18 +174,13 @@ - (BOOL)analyzeMerge:(GTMergeAnalysis *)analysis fromBranch:(GTBranch *)fromBran } git_annotated_commit *annotatedCommit; - - int gitError = git_annotated_commit_lookup(&annotatedCommit, self.git_repository, fromCommit.OID.git_oid); - if (gitError != GIT_OK) { - if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to lookup annotated comit for %@", fromCommit]; - return NO; - } + [self annotatedCommit:&annotatedCommit fromCommit:fromCommit error:error]; // Allow fast-forward or normal merge git_merge_preference_t preference = GIT_MERGE_PREFERENCE_NONE; // Merge analysis - gitError = git_merge_analysis((git_merge_analysis_t *)analysis, &preference, self.git_repository, (const git_annotated_commit **) &annotatedCommit, 1); + int gitError = git_merge_analysis((git_merge_analysis_t *)analysis, &preference, self.git_repository, (const git_annotated_commit **) &annotatedCommit, 1); if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to analyze merge"]; return NO; From 3821527e57228233aff3919d4003f4ad390b32b0 Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Thu, 3 Mar 2016 10:24:44 +0800 Subject: [PATCH 042/228] Add Tests --- ObjectiveGitTests/GTRepository+PullSpec.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ObjectiveGitTests/GTRepository+PullSpec.m b/ObjectiveGitTests/GTRepository+PullSpec.m index ac3864ef7..20f97e994 100644 --- a/ObjectiveGitTests/GTRepository+PullSpec.m +++ b/ObjectiveGitTests/GTRepository+PullSpec.m @@ -255,9 +255,13 @@ BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_transfer_progress *progress, BOOL *stop) { transferProgressed = YES; }]; + NSString *fileContents = [NSString stringWithContentsOfURL:[localRepo.fileURL URLByAppendingPathComponent:@"test.txt"] encoding:NSUTF8StringEncoding error:nil]; expect(@(result)).to(beFalsy()); expect(error.domain).to(equal(@"GTGitErrorDomain")); expect(error.userInfo[GTPullMergeConflictedFiles]).to(equal(@[@"test.txt"])); + expect(fileContents).notTo(equal(@"TestLocal")); + expect([localRepo mergeHeadEntriesWithError:nil]).to(equal(@[remoteCommit])); + expect([localRepo preparedMessageWithError:nil]).to(beginWith(@"Merge commit")); expect(error.localizedDescription).to(equal(@"Merge conflict, Pull aborted.")); expect(@(transferProgressed)).to(beTruthy()); }); From 07d8c3f124856c09ee53db429691718bb348a77e Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Thu, 3 Mar 2016 13:48:38 +0800 Subject: [PATCH 043/228] Move analyse to GTRepository+Merging --- ObjectiveGit/GTRepository+Merging.h | 24 ++++++++++++++++++++++++ ObjectiveGit/GTRepository+Merging.m | 28 ++++++++++++++++++++++++++++ ObjectiveGit/GTRepository+Pull.h | 24 ------------------------ ObjectiveGit/GTRepository+Pull.m | 27 --------------------------- 4 files changed, 52 insertions(+), 51 deletions(-) diff --git a/ObjectiveGit/GTRepository+Merging.h b/ObjectiveGit/GTRepository+Merging.h index 57013183c..1a33eee9b 100644 --- a/ObjectiveGit/GTRepository+Merging.h +++ b/ObjectiveGit/GTRepository+Merging.h @@ -7,9 +7,23 @@ // #import "GTRepository.h" +#import "git2/merge.h" NS_ASSUME_NONNULL_BEGIN +/// UserInfo key for conflicted files when pulling fails with a merge conflict +extern NSString * const GTPullMergeConflictedFiles; + +/// An enum describing the result of the merge analysis. +/// See `git_merge_analysis_t`. +typedef NS_OPTIONS(NSInteger, GTMergeAnalysis) { + GTMergeAnalysisNone = GIT_MERGE_ANALYSIS_NONE, + GTMergeAnalysisNormal = GIT_MERGE_ANALYSIS_NORMAL, + GTMergeAnalysisUpToDate = GIT_MERGE_ANALYSIS_UP_TO_DATE, + GTMergeAnalysisUnborn = GIT_MERGE_ANALYSIS_UNBORN, + GTMergeAnalysisFastForward = GIT_MERGE_ANALYSIS_FASTFORWARD, +}; + @interface GTRepository (Merging) /// Enumerate all available merge head entries. @@ -29,6 +43,16 @@ NS_ASSUME_NONNULL_BEGIN /// Retruns a (possibly empty) array with GTCommit objects. Will not be nil. - (NSArray *)mergeHeadEntriesWithError:(NSError **)error; +/// Analyze which merge to perform. +/// +/// analysis - The resulting analysis. +/// fromBranch - The branch to merge from. +/// error - The error if one occurred. Can be NULL. +/// +/// Returns YES if the analysis was successful, NO otherwise (and `error`, if provided, +/// will point to an error describing what happened). +- (BOOL)analyzeMerge:(GTMergeAnalysis *)analysis fromBranch:(GTBranch *)fromBranch error:(NSError **)error; + @end NS_ASSUME_NONNULL_END diff --git a/ObjectiveGit/GTRepository+Merging.m b/ObjectiveGit/GTRepository+Merging.m index 0acbc095e..fcf5f6880 100644 --- a/ObjectiveGit/GTRepository+Merging.m +++ b/ObjectiveGit/GTRepository+Merging.m @@ -67,4 +67,32 @@ - (NSArray *)mergeHeadEntriesWithError:(NSError **)error { return entries; } +- (BOOL)analyzeMerge:(GTMergeAnalysis *)analysis fromBranch:(GTBranch *)fromBranch error:(NSError **)error { + NSParameterAssert(analysis != NULL); + NSParameterAssert(fromBranch != nil); + + GTCommit *fromCommit = [fromBranch targetCommitWithError:error]; + if (!fromCommit) { + return NO; + } + + git_annotated_commit *annotatedCommit; + [self annotatedCommit:&annotatedCommit fromCommit:fromCommit error:error]; + + // Allow fast-forward or normal merge + git_merge_preference_t preference = GIT_MERGE_PREFERENCE_NONE; + + // Merge analysis + int gitError = git_merge_analysis((git_merge_analysis_t *)analysis, &preference, self.git_repository, (const git_annotated_commit **) &annotatedCommit, 1); + if (gitError != GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to analyze merge"]; + return NO; + } + + // Cleanup + git_annotated_commit_free(annotatedCommit); + + return YES; +} + @end diff --git a/ObjectiveGit/GTRepository+Pull.h b/ObjectiveGit/GTRepository+Pull.h index de0b1f50e..f1b357456 100644 --- a/ObjectiveGit/GTRepository+Pull.h +++ b/ObjectiveGit/GTRepository+Pull.h @@ -7,23 +7,9 @@ // #import "GTRepository.h" -#import "git2/merge.h" NS_ASSUME_NONNULL_BEGIN -/// UserInfo key for conflicted files when pulling fails with a merge conflict -extern NSString * const GTPullMergeConflictedFiles; - -/// An enum describing the result of the merge analysis. -/// See `git_merge_analysis_t`. -typedef NS_OPTIONS(NSInteger, GTMergeAnalysis) { - GTMergeAnalysisNone = GIT_MERGE_ANALYSIS_NONE, - GTMergeAnalysisNormal = GIT_MERGE_ANALYSIS_NORMAL, - GTMergeAnalysisUpToDate = GIT_MERGE_ANALYSIS_UP_TO_DATE, - GTMergeAnalysisUnborn = GIT_MERGE_ANALYSIS_UNBORN, - GTMergeAnalysisFastForward = GIT_MERGE_ANALYSIS_FASTFORWARD, -}; - typedef void (^GTRemoteFetchTransferProgressBlock)(const git_transfer_progress *progress, BOOL *stop); @interface GTRepository (Pull) @@ -44,16 +30,6 @@ typedef void (^GTRemoteFetchTransferProgressBlock)(const git_transfer_progress * /// will point to an error describing what happened). - (BOOL)pullBranch:(GTBranch *)branch fromRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options error:(NSError **)error progress:(nullable GTRemoteFetchTransferProgressBlock)progressBlock; -/// Analyze which merge to perform. -/// -/// analysis - The resulting analysis. -/// fromBranch - The branch to merge from. -/// error - The error if one occurred. Can be NULL. -/// -/// Returns YES if the analysis was successful, NO otherwise (and `error`, if provided, -/// will point to an error describing what happened). -- (BOOL)analyzeMerge:(GTMergeAnalysis *)analysis fromBranch:(GTBranch *)fromBranch error:(NSError **)error; - @end NS_ASSUME_NONNULL_END diff --git a/ObjectiveGit/GTRepository+Pull.m b/ObjectiveGit/GTRepository+Pull.m index 3e39530fc..8d159eb55 100644 --- a/ObjectiveGit/GTRepository+Pull.m +++ b/ObjectiveGit/GTRepository+Pull.m @@ -163,33 +163,6 @@ - (BOOL)annotatedCommit:(git_annotated_commit **)annotatedCommit fromCommit:(GTC return YES; } - -- (BOOL)analyzeMerge:(GTMergeAnalysis *)analysis fromBranch:(GTBranch *)fromBranch error:(NSError **)error { - NSParameterAssert(analysis != NULL); - NSParameterAssert(fromBranch != nil); - - GTCommit *fromCommit = [fromBranch targetCommitWithError:error]; - if (!fromCommit) { - return NO; - } - - git_annotated_commit *annotatedCommit; - [self annotatedCommit:&annotatedCommit fromCommit:fromCommit error:error]; - - // Allow fast-forward or normal merge - git_merge_preference_t preference = GIT_MERGE_PREFERENCE_NONE; - - // Merge analysis - int gitError = git_merge_analysis((git_merge_analysis_t *)analysis, &preference, self.git_repository, (const git_annotated_commit **) &annotatedCommit, 1); - if (gitError != GIT_OK) { - if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to analyze merge"]; - return NO; - } - - // Cleanup - git_annotated_commit_free(annotatedCommit); - - return YES; } @end From efb15d1d7b69f348c8a597bcb7d28eff4a64074c Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Thu, 3 Mar 2016 13:49:11 +0800 Subject: [PATCH 044/228] Move merging to public method --- ObjectiveGit/GTRepository+Merging.h | 10 +++ ObjectiveGit/GTRepository+Merging.m | 117 ++++++++++++++++++++++++++++ ObjectiveGit/GTRepository+Pull.m | 117 +--------------------------- 3 files changed, 129 insertions(+), 115 deletions(-) diff --git a/ObjectiveGit/GTRepository+Merging.h b/ObjectiveGit/GTRepository+Merging.h index 1a33eee9b..4c594fe51 100644 --- a/ObjectiveGit/GTRepository+Merging.h +++ b/ObjectiveGit/GTRepository+Merging.h @@ -43,6 +43,16 @@ typedef NS_OPTIONS(NSInteger, GTMergeAnalysis) { /// Retruns a (possibly empty) array with GTCommit objects. Will not be nil. - (NSArray *)mergeHeadEntriesWithError:(NSError **)error; +/// Merge Branch into current branch +/// +/// analysis - The resulting analysis. +/// fromBranch - The branch to merge from. +/// error - The error if one occurred. Can be NULL. +/// +/// Returns YES if the nerge was successful, NO otherwise (and `error`, if provided, +/// will point to an error describing what happened). +- (BOOL)mergeBranchIntoCurrentBranch:(GTBranch *)fromBranch withError:(NSError **)error; + /// Analyze which merge to perform. /// /// analysis - The resulting analysis. diff --git a/ObjectiveGit/GTRepository+Merging.m b/ObjectiveGit/GTRepository+Merging.m index fcf5f6880..6074a929b 100644 --- a/ObjectiveGit/GTRepository+Merging.m +++ b/ObjectiveGit/GTRepository+Merging.m @@ -10,6 +10,13 @@ #import "GTOID.h" #import "NSError+Git.h" #import "git2/errors.h" +#import "GTCommit.h" +#import "GTReference.h" +#import "GTRepository+Committing.h" +#import "GTRepository+Pull.h" +#import "GTTree.h" +#import "GTIndex.h" +#import "GTIndexEntry.h" typedef void (^GTRemoteFetchTransferProgressBlock)(const git_transfer_progress *stats, BOOL *stop); @@ -67,6 +74,116 @@ - (NSArray *)mergeHeadEntriesWithError:(NSError **)error { return entries; } +- (BOOL)mergeBranchIntoCurrentBranch:(GTBranch *)branch withError:(NSError **)error { + // Check if merge is necessary + GTBranch *localBranch = [self currentBranchWithError:error]; + if (!localBranch) { + return NO; + } + + GTCommit *localCommit = [localBranch targetCommitWithError:error]; + if (!localCommit) { + return NO; + } + + GTCommit *remoteCommit = [branch targetCommitWithError:error]; + if (!remoteCommit) { + return NO; + } + + if ([localCommit.SHA isEqualToString:remoteCommit.SHA]) { + // Local and remote tracking branch are already in sync + return YES; + } + + GTMergeAnalysis analysis = GTMergeAnalysisNone; + BOOL success = [self analyzeMerge:&analysis fromBranch:branch error:error]; + if (!success) { + return NO; + } + + if (analysis & GTMergeAnalysisUpToDate) { + // Nothing to do + return YES; + } else if (analysis & GTMergeAnalysisFastForward || + analysis & GTMergeAnalysisUnborn) { + // Fast-forward branch + NSString *message = [NSString stringWithFormat:@"merge %@: Fast-forward", branch.name]; + GTReference *reference = [localBranch.reference referenceByUpdatingTarget:remoteCommit.SHA message:message error:error]; + BOOL checkoutSuccess = [self checkoutReference:reference strategy:GTCheckoutStrategyForce error:error progressBlock:nil]; + + return checkoutSuccess; + } else if (analysis & GTMergeAnalysisNormal) { + // Do normal merge + GTTree *localTree = localCommit.tree; + GTTree *remoteTree = remoteCommit.tree; + + // TODO: Find common ancestor + GTTree *ancestorTree = nil; + + // Merge + GTIndex *index = [localTree merge:remoteTree ancestor:ancestorTree error:error]; + if (!index) { + return NO; + } + + // Check for conflict + if (index.hasConflicts) { + NSMutableArray *files = [NSMutableArray array]; + [index enumerateConflictedFilesWithError:error usingBlock:^(GTIndexEntry * _Nonnull ancestor, GTIndexEntry * _Nonnull ours, GTIndexEntry * _Nonnull theirs, BOOL * _Nonnull stop) { + [files addObject:ours.path]; + }]; + + if (error != NULL) { + NSDictionary *userInfo = @{GTPullMergeConflictedFiles: files}; + *error = [NSError git_errorFor:GIT_ECONFLICT description:@"Merge conflict" userInfo:userInfo failureReason:nil]; + } + + // Write conflicts + git_merge_options merge_opts = GIT_MERGE_OPTIONS_INIT; + git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT; + checkout_opts.checkout_strategy = GIT_CHECKOUT_ALLOW_CONFLICTS; + + git_annotated_commit *annotatedCommit; + [self annotatedCommit:&annotatedCommit fromCommit:remoteCommit error:error]; + + git_merge(self.git_repository, (const git_annotated_commit **)&annotatedCommit, 1, &merge_opts, &checkout_opts); + + return NO; + } + + GTTree *newTree = [index writeTreeToRepository:self error:error]; + if (!newTree) { + return NO; + } + + // Create merge commit + NSString *message = [NSString stringWithFormat:@"Merge branch '%@'", localBranch.shortName]; + NSArray *parents = @[ localCommit, remoteCommit ]; + + // FIXME: This is stepping on the local tree + GTCommit *mergeCommit = [self createCommitWithTree:newTree message:message parents:parents updatingReferenceNamed:localBranch.name error:error]; + if (!mergeCommit) { + return NO; + } + + BOOL success = [self checkoutReference:localBranch.reference strategy:GTCheckoutStrategyForce error:error progressBlock:nil]; + return success; + } + + return NO; +} + +- (BOOL)annotatedCommit:(git_annotated_commit **)annotatedCommit fromCommit:(GTCommit *)fromCommit error:(NSError **)error { + int gitError = git_annotated_commit_lookup(annotatedCommit, self.git_repository, fromCommit.OID.git_oid); + if (gitError != GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to lookup annotated commit for %@", fromCommit]; + return NO; + } + + return YES; +} + - (BOOL)analyzeMerge:(GTMergeAnalysis *)analysis fromBranch:(GTBranch *)fromBranch error:(NSError **)error { NSParameterAssert(analysis != NULL); NSParameterAssert(fromBranch != nil); diff --git a/ObjectiveGit/GTRepository+Pull.m b/ObjectiveGit/GTRepository+Pull.m index 8d159eb55..b99bf37ce 100644 --- a/ObjectiveGit/GTRepository+Pull.m +++ b/ObjectiveGit/GTRepository+Pull.m @@ -9,16 +9,10 @@ #import "GTRepository+Pull.h" #import "GTCommit.h" -#import "GTIndex.h" -#import "GTOID.h" -#import "GTRemote.h" -#import "GTReference.h" -#import "GTRepository+Committing.h" #import "GTRepository+RemoteOperations.h" -#import "GTTree.h" #import "NSError+Git.h" -#import "GTIndexEntry.h" #import "git2/errors.h" +#import "GTRepository+Merging.h" NSString * const GTPullMergeConflictedFiles = @"GTPullMergeConflictedFiles"; @@ -55,114 +49,7 @@ - (BOOL)pullBranch:(GTBranch *)branch fromRemote:(GTRemote *)remote withOptions: trackingBranch = branch; } - // Check if merge is necessary - GTBranch *localBranch = [repo currentBranchWithError:error]; - if (!localBranch) { - return NO; - } - - GTCommit *localCommit = [localBranch targetCommitWithError:error]; - if (!localCommit) { - return NO; - } - - GTCommit *remoteCommit = [trackingBranch targetCommitWithError:error]; - if (!remoteCommit) { - return NO; - } - - if ([localCommit.SHA isEqualToString:remoteCommit.SHA]) { - // Local and remote tracking branch are already in sync - return YES; - } - - GTMergeAnalysis analysis = GTMergeAnalysisNone; - BOOL success = [self analyzeMerge:&analysis fromBranch:trackingBranch error:error]; - if (!success) { - return NO; - } - - if (analysis & GTMergeAnalysisUpToDate) { - // Nothing to do - return YES; - } else if (analysis & GTMergeAnalysisFastForward || - analysis & GTMergeAnalysisUnborn) { - // Fast-forward branch - NSString *message = [NSString stringWithFormat:@"merge %@/%@: Fast-forward", remote.name, trackingBranch.name]; - GTReference *reference = [localBranch.reference referenceByUpdatingTarget:remoteCommit.SHA message:message error:error]; - BOOL checkoutSuccess = [self checkoutReference:reference strategy:GTCheckoutStrategyForce error:error progressBlock:nil]; - - return checkoutSuccess; - } else if (analysis & GTMergeAnalysisNormal) { - // Do normal merge - GTTree *localTree = localCommit.tree; - GTTree *remoteTree = remoteCommit.tree; - - // TODO: Find common ancestor - GTTree *ancestorTree = nil; - - // Merge - GTIndex *index = [localTree merge:remoteTree ancestor:ancestorTree error:error]; - if (!index) { - return NO; - } - - // Check for conflict - if (index.hasConflicts) { - NSMutableArray *files = [NSMutableArray array]; - [index enumerateConflictedFilesWithError:error usingBlock:^(GTIndexEntry * _Nonnull ancestor, GTIndexEntry * _Nonnull ours, GTIndexEntry * _Nonnull theirs, BOOL * _Nonnull stop) { - [files addObject:ours.path]; - }]; - - if (error != NULL) { - NSDictionary *userInfo = @{GTPullMergeConflictedFiles: files}; - *error = [NSError git_errorFor:GIT_ECONFLICT description:@"Merge conflict, Pull aborted." userInfo:userInfo failureReason:nil]; - } - - // Write conflicts - git_merge_options merge_opts = GIT_MERGE_OPTIONS_INIT; - git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT; - checkout_opts.checkout_strategy = GIT_CHECKOUT_ALLOW_CONFLICTS; - - git_annotated_commit *annotatedCommit; - [self annotatedCommit:&annotatedCommit fromCommit:remoteCommit error:error]; - - git_merge(repo.git_repository, (const git_annotated_commit **)&annotatedCommit, 1, &merge_opts, &checkout_opts); - - return NO; - } - - GTTree *newTree = [index writeTreeToRepository:repo error:error]; - if (!newTree) { - return NO; - } - - // Create merge commit - NSString *message = [NSString stringWithFormat:@"Merge branch '%@'", localBranch.shortName]; - NSArray *parents = @[ localCommit, remoteCommit ]; - - // FIXME: This is stepping on the local tree - GTCommit *mergeCommit = [repo createCommitWithTree:newTree message:message parents:parents updatingReferenceNamed:localBranch.name error:error]; - if (!mergeCommit) { - return NO; - } - - BOOL success = [self checkoutReference:localBranch.reference strategy:GTCheckoutStrategyForce error:error progressBlock:nil]; - return success; - } - - return NO; -} - -- (BOOL)annotatedCommit:(git_annotated_commit **)annotatedCommit fromCommit:(GTCommit *)fromCommit error:(NSError **)error { - int gitError = git_annotated_commit_lookup(annotatedCommit, self.git_repository, fromCommit.OID.git_oid); - if (gitError != GIT_OK) { - if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to lookup annotated commit for %@", fromCommit]; - return NO; - } - - return YES; -} + return [repo mergeBranchIntoCurrentBranch:trackingBranch withError:error]; } @end From b973182023de348f2fe202b4aa092671c7252649 Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Thu, 3 Mar 2016 13:52:02 +0800 Subject: [PATCH 045/228] Fix test --- ObjectiveGitTests/GTRepository+PullSpec.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGitTests/GTRepository+PullSpec.m b/ObjectiveGitTests/GTRepository+PullSpec.m index 20f97e994..b970c5a6d 100644 --- a/ObjectiveGitTests/GTRepository+PullSpec.m +++ b/ObjectiveGitTests/GTRepository+PullSpec.m @@ -262,7 +262,7 @@ expect(fileContents).notTo(equal(@"TestLocal")); expect([localRepo mergeHeadEntriesWithError:nil]).to(equal(@[remoteCommit])); expect([localRepo preparedMessageWithError:nil]).to(beginWith(@"Merge commit")); - expect(error.localizedDescription).to(equal(@"Merge conflict, Pull aborted.")); + expect(error.localizedDescription).to(equal(@"Merge conflict")); expect(@(transferProgressed)).to(beTruthy()); }); From 6323ca5394371733c96b350a75e1d7fa4e1ba5cd Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Thu, 3 Mar 2016 23:29:15 +0800 Subject: [PATCH 046/228] Fix typos --- ObjectiveGit/GTRepository+Merging.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ObjectiveGit/GTRepository+Merging.h b/ObjectiveGit/GTRepository+Merging.h index 4c594fe51..08ad683bc 100644 --- a/ObjectiveGit/GTRepository+Merging.h +++ b/ObjectiveGit/GTRepository+Merging.h @@ -45,11 +45,10 @@ typedef NS_OPTIONS(NSInteger, GTMergeAnalysis) { /// Merge Branch into current branch /// -/// analysis - The resulting analysis. /// fromBranch - The branch to merge from. /// error - The error if one occurred. Can be NULL. /// -/// Returns YES if the nerge was successful, NO otherwise (and `error`, if provided, +/// Returns YES if the merge was successful, NO otherwise (and `error`, if provided, /// will point to an error describing what happened). - (BOOL)mergeBranchIntoCurrentBranch:(GTBranch *)fromBranch withError:(NSError **)error; From 28afdb8b00f0841248bf81982a83ab26dee985e3 Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Fri, 4 Mar 2016 01:10:10 +0800 Subject: [PATCH 047/228] Return GTOIDs instead of GTCommits --- ObjectiveGit/GTRepository+Merging.h | 6 +++--- ObjectiveGit/GTRepository+Merging.m | 13 +++++-------- ObjectiveGitTests/GTRepository+PullSpec.m | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/ObjectiveGit/GTRepository+Merging.h b/ObjectiveGit/GTRepository+Merging.h index 08ad683bc..00a025073 100644 --- a/ObjectiveGit/GTRepository+Merging.h +++ b/ObjectiveGit/GTRepository+Merging.h @@ -34,14 +34,14 @@ typedef NS_OPTIONS(NSInteger, GTMergeAnalysis) { /// enumeration to stop after the block returns. Must not be nil. /// /// Returns YES if the operation succedded, NO otherwise. -- (BOOL)enumerateMergeHeadEntriesWithError:(NSError **)error usingBlock:(void (^)(GTCommit *mergeHeadEntry, BOOL *stop))block; +- (BOOL)enumerateMergeHeadEntriesWithError:(NSError **)error usingBlock:(void (^)(GTOID *mergeHeadEntry, BOOL *stop))block; /// Convenience method for -enumerateMergeHeadEntriesWithError:usingBlock: that retuns an NSArray with all the fetch head entries. /// /// error - The error if one ocurred. Can be NULL. /// -/// Retruns a (possibly empty) array with GTCommit objects. Will not be nil. -- (NSArray *)mergeHeadEntriesWithError:(NSError **)error; +/// Retruns a (possibly empty) array with GTOID objects. Will not be nil. +- (NSArray *)mergeHeadEntriesWithError:(NSError **)error; /// Merge Branch into current branch /// diff --git a/ObjectiveGit/GTRepository+Merging.m b/ObjectiveGit/GTRepository+Merging.m index 6074a929b..aa4169e17 100644 --- a/ObjectiveGit/GTRepository+Merging.m +++ b/ObjectiveGit/GTRepository+Merging.m @@ -22,33 +22,30 @@ @implementation GTRepository (Merging) -typedef void (^GTRepositoryEnumerateMergeHeadEntryBlock)(GTCommit *entry, BOOL *stop); +typedef void (^GTRepositoryEnumerateMergeHeadEntryBlock)(GTOID *entry, BOOL *stop); typedef struct { - __unsafe_unretained GTRepository *repository; __unsafe_unretained GTRepositoryEnumerateMergeHeadEntryBlock enumerationBlock; } GTEnumerateMergeHeadEntriesPayload; int GTMergeHeadEntriesCallback(const git_oid *oid, void *payload) { GTEnumerateMergeHeadEntriesPayload *entriesPayload = payload; - GTRepository *repository = entriesPayload->repository; GTRepositoryEnumerateMergeHeadEntryBlock enumerationBlock = entriesPayload->enumerationBlock; - GTCommit *commit = [repository lookUpObjectByOID:[GTOID oidWithGitOid:oid] objectType:GTObjectTypeCommit error:NULL]; + GTOID *gtoid = [GTOID oidWithGitOid:oid]; BOOL stop = NO; - enumerationBlock(commit, &stop); + enumerationBlock(gtoid, &stop); return (stop == YES ? GIT_EUSER : 0); } -- (BOOL)enumerateMergeHeadEntriesWithError:(NSError **)error usingBlock:(void (^)(GTCommit *mergeHeadEntry, BOOL *stop))block { +- (BOOL)enumerateMergeHeadEntriesWithError:(NSError **)error usingBlock:(void (^)(GTOID *mergeHeadEntry, BOOL *stop))block { NSParameterAssert(block != nil); GTEnumerateMergeHeadEntriesPayload payload = { - .repository = self, .enumerationBlock = block, }; @@ -65,7 +62,7 @@ - (BOOL)enumerateMergeHeadEntriesWithError:(NSError **)error usingBlock:(void (^ - (NSArray *)mergeHeadEntriesWithError:(NSError **)error { NSMutableArray *entries = [NSMutableArray array]; - [self enumerateMergeHeadEntriesWithError:error usingBlock:^(GTCommit *mergeHeadEntry, BOOL *stop) { + [self enumerateMergeHeadEntriesWithError:error usingBlock:^(GTOID *mergeHeadEntry, BOOL *stop) { [entries addObject:mergeHeadEntry]; *stop = NO; diff --git a/ObjectiveGitTests/GTRepository+PullSpec.m b/ObjectiveGitTests/GTRepository+PullSpec.m index b970c5a6d..ef0999566 100644 --- a/ObjectiveGitTests/GTRepository+PullSpec.m +++ b/ObjectiveGitTests/GTRepository+PullSpec.m @@ -260,7 +260,7 @@ expect(error.domain).to(equal(@"GTGitErrorDomain")); expect(error.userInfo[GTPullMergeConflictedFiles]).to(equal(@[@"test.txt"])); expect(fileContents).notTo(equal(@"TestLocal")); - expect([localRepo mergeHeadEntriesWithError:nil]).to(equal(@[remoteCommit])); + expect([localRepo mergeHeadEntriesWithError:nil]).to(equal(@[remoteCommit.OID])); expect([localRepo preparedMessageWithError:nil]).to(beginWith(@"Merge commit")); expect(error.localizedDescription).to(equal(@"Merge conflict")); expect(@(transferProgressed)).to(beTruthy()); From 8f813cd5201042219d6f1e5b3fc7c4445cb1b011 Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Thu, 10 Mar 2016 14:21:23 +0800 Subject: [PATCH 048/228] Add support for pruning and ignoring tags --- ObjectiveGit/GTRepository+Pull.h | 2 ++ ObjectiveGit/GTRepository+RemoteOperations.h | 17 +++++++++++++++++ ObjectiveGit/GTRepository+RemoteOperations.m | 4 ++++ 3 files changed, 23 insertions(+) diff --git a/ObjectiveGit/GTRepository+Pull.h b/ObjectiveGit/GTRepository+Pull.h index f1b357456..8af3b1cd7 100644 --- a/ObjectiveGit/GTRepository+Pull.h +++ b/ObjectiveGit/GTRepository+Pull.h @@ -23,6 +23,8 @@ typedef void (^GTRemoteFetchTransferProgressBlock)(const git_transfer_progress * /// options - Options applied to the fetch operation. /// Recognized options are: /// `GTRepositoryRemoteOptionsCredentialProvider` +/// `GTRepositoryRemoteOptionsFetchPrune` +/// `GTRepositoryRemoteOptionsDownloadTags` /// error - The error if one occurred. Can be NULL. /// progressBlock - An optional callback for monitoring progress. /// diff --git a/ObjectiveGit/GTRepository+RemoteOperations.h b/ObjectiveGit/GTRepository+RemoteOperations.h index 5afe6d2d1..4e675d489 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.h +++ b/ObjectiveGit/GTRepository+RemoteOperations.h @@ -7,6 +7,7 @@ // #import "GTRepository.h" +#import "git2/remote.h" @class GTFetchHeadEntry; @@ -15,6 +16,20 @@ NS_ASSUME_NONNULL_BEGIN /// A `GTCredentialProvider`, that will be used to authenticate against the remote. extern NSString *const GTRepositoryRemoteOptionsCredentialProvider; +/// A `GTFetchPruneOption`, that will be used to determine if the fetch should prune or not. +extern NSString *const GTRepositoryRemoteOptionsFetchPrune; + +/// A `GTRemoteAutoTagOption`, that will be used to determine how the fetch should handle tags. +extern NSString *const GTRepositoryRemoteOptionsDownloadTags; + +/// An enum describing the data needed for pruning. +/// See `git_fetch_prune_t`. +typedef NS_ENUM(NSInteger, GTFetchPruneOption) { + GTFetchPruneOptionUnspecified = GIT_FETCH_PRUNE_UNSPECIFIED, + GTFetchPruneOptionYes = GIT_FETCH_PRUNE, + GTFetchPruneOptionNo = GIT_FETCH_NO_PRUNE, +}; + @interface GTRepository (RemoteOperations) #pragma mark - Fetch @@ -25,6 +40,8 @@ extern NSString *const GTRepositoryRemoteOptionsCredentialProvider; /// options - Options applied to the fetch operation. May be nil. /// Recognized options are : /// `GTRepositoryRemoteOptionsCredentialProvider` +/// `GTRepositoryRemoteOptionsFetchPrune` +/// `GTRepositoryRemoteOptionsDownloadTags` /// error - The error if one occurred. Can be NULL. /// progressBlock - Optional callback to receive fetch progress stats during the /// transfer. May be nil. diff --git a/ObjectiveGit/GTRepository+RemoteOperations.m b/ObjectiveGit/GTRepository+RemoteOperations.m index e81ab8500..a03cbe28f 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.m +++ b/ObjectiveGit/GTRepository+RemoteOperations.m @@ -23,6 +23,8 @@ #import "git2/remote.h" NSString *const GTRepositoryRemoteOptionsCredentialProvider = @"GTRepositoryRemoteOptionsCredentialProvider"; +NSString *const GTRepositoryRemoteOptionsFetchPrune = @"GTRepositoryRemoteOptionsFetchPrune"; +NSString *const GTRepositoryRemoteOptionsDownloadTags = @"GTRepositoryRemoteOptionsDownloadTags"; typedef void (^GTRemoteFetchTransferProgressBlock)(const git_transfer_progress *stats, BOOL *stop); typedef void (^GTRemotePushTransferProgressBlock)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop); @@ -80,6 +82,8 @@ - (BOOL)fetchRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error git_fetch_options fetchOptions = GIT_FETCH_OPTIONS_INIT; fetchOptions.callbacks = remote_callbacks; + fetchOptions.prune = [options[GTRepositoryRemoteOptionsFetchPrune] unsignedIntValue]; + fetchOptions.download_tags = [options[GTRepositoryRemoteOptionsDownloadTags] unsignedIntValue]; __block git_strarray refspecs; int gitError = git_remote_get_fetch_refspecs(&refspecs, remote.git_remote); From abc1d741a4c6580d748cb07b95317ecfc71c3b0d Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Wed, 23 Mar 2016 14:20:38 +0300 Subject: [PATCH 049/228] Updating libgit2 pointer --- External/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libgit2 b/External/libgit2 index c27b4afcd..661db4f48 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit c27b4afcdd80f5a45d7120044bf3d78272181abb +Subproject commit 661db4f4829a0fe1330f275de6e58c34589f512f From 41279e4b7f6e3946393f2728f447773e5f093113 Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Wed, 23 Mar 2016 15:35:04 +0300 Subject: [PATCH 050/228] Updating for new libgit2 git_remote_connect() call --- ObjectiveGit/GTRepository+RemoteOperations.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTRepository+RemoteOperations.m b/ObjectiveGit/GTRepository+RemoteOperations.m index a03cbe28f..84716d495 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.m +++ b/ObjectiveGit/GTRepository+RemoteOperations.m @@ -226,7 +226,7 @@ - (BOOL)pushRefspecs:(NSArray *)refspecs toRemote:(GTRemote *)remote withOptions remote_callbacks.push_transfer_progress = GTRemotePushTransferProgressCallback; remote_callbacks.payload = &connectionInfo, - gitError = git_remote_connect(remote.git_remote, GIT_DIRECTION_PUSH, &remote_callbacks); + gitError = git_remote_connect(remote.git_remote, GIT_DIRECTION_PUSH, &remote_callbacks, NULL); if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to connect remote"]; return NO; From 0a9019b62919b77be7c3790d4569ee959acc5995 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Wed, 23 Mar 2016 12:18:16 -0400 Subject: [PATCH 051/228] GTTreeBuilder: don't add blob data lazily Don't add the blob data lazily to the object database (during tree creation), which would prevent strict object validity checking from functioning. In addition, this prevents us from hashing the file twice (once to compute the OID, again when adding to the object database) and reduces memory overhead. --- ObjectiveGit/GTTreeBuilder.m | 46 +++------------------------ ObjectiveGitTests/GTTreeBuilderSpec.m | 6 ++-- 2 files changed, 6 insertions(+), 46 deletions(-) diff --git a/ObjectiveGit/GTTreeBuilder.m b/ObjectiveGit/GTTreeBuilder.m index 6aa5da7a4..5ae85646a 100644 --- a/ObjectiveGit/GTTreeBuilder.m +++ b/ObjectiveGit/GTTreeBuilder.m @@ -43,13 +43,6 @@ @interface GTTreeBuilder () @property (nonatomic, assign, readonly) git_treebuilder *git_treebuilder; @property (nonatomic, strong, readonly) GTRepository *repository; -// Data to be written with the tree, keyed by the file name. This should only be -// accessed while synchronized on self. -// -// This is needed because we don't want to add the entries to the object -// database until the tree's been written. -@property (nonatomic, strong, readonly) NSMutableDictionary *fileNameToPendingData; - @end @implementation GTTreeBuilder @@ -80,8 +73,6 @@ - (instancetype)initWithTree:(GTTree *)treeOrNil repository:(GTRepository *)repo } _repository = repository; - _fileNameToPendingData = [NSMutableDictionary dictionary]; - return self; } @@ -122,12 +113,11 @@ - (GTTreeEntry *)addEntryWithData:(NSData *)data fileName:(NSString *)fileName f NSParameterAssert(data != nil); NSParameterAssert(fileName != nil); - GTOID *OID = [GTOID OIDByHashingData:data type:GTObjectTypeBlob error:error]; - if (OID == nil) return nil; + GTObjectDatabase *odb = [self.repository objectDatabaseWithError:error]; + if (odb == nil) return nil; - @synchronized (self) { - self.fileNameToPendingData[fileName] = data; - } + GTOID *OID = [odb writeData:data type:GTObjectTypeBlob error:error]; + if (OID == nil) return nil; return [self addEntryWithOID:OID fileName:fileName fileMode:fileMode error:error]; } @@ -153,38 +143,10 @@ - (BOOL)removeEntryWithFileName:(NSString *)fileName error:(NSError **)error { if (error != NULL) *error = [NSError git_errorFor:status description:@"Failed to remove entry with name %@ from tree builder.", fileName]; } - @synchronized (self) { - [self.fileNameToPendingData removeObjectForKey:fileName]; - } - return status == GIT_OK; } -- (BOOL)writePendingData:(NSError **)error { - NSDictionary *copied; - @synchronized (self) { - copied = [self.fileNameToPendingData copy]; - [self.fileNameToPendingData removeAllObjects]; - } - - if (copied.count != 0) { - GTObjectDatabase *odb = [self.repository objectDatabaseWithError:error]; - if (odb == nil) return NO; - - for (NSString *fileName in copied) { - NSData *data = copied[fileName]; - GTOID *dataOID = [odb writeData:data type:GTObjectTypeBlob error:error]; - if (dataOID == nil) return NO; - } - } - - return YES; -} - - (GTTree *)writeTree:(NSError **)error { - BOOL success = [self writePendingData:error]; - if (!success) return nil; - git_oid treeOid; int status = git_treebuilder_write(&treeOid, self.git_treebuilder); if (status != GIT_OK) { diff --git a/ObjectiveGitTests/GTTreeBuilderSpec.m b/ObjectiveGitTests/GTTreeBuilderSpec.m index c05b80637..547a9b149 100644 --- a/ObjectiveGitTests/GTTreeBuilderSpec.m +++ b/ObjectiveGitTests/GTTreeBuilderSpec.m @@ -103,19 +103,17 @@ expect(foundEntry.SHA).to(equal(entry.SHA)); }); - it(@"should write new blobs when the tree is written", ^{ + it(@"should be possible to write a blob with data", ^{ GTTreeEntry *entry = [builder addEntryWithData:[@"Hello, World!" dataUsingEncoding:NSUTF8StringEncoding] fileName:@"test.txt" fileMode:GTFileModeBlob error:NULL]; expect(entry).notTo(beNil()); GTObjectDatabase *database = [repo objectDatabaseWithError:NULL]; expect(database).notTo(beNil()); - expect(@([database containsObjectWithOID:entry.OID])).to(beFalsy()); + expect(@([database containsObjectWithOID:entry.OID])).to(beTruthy()); GTTree *tree = [builder writeTree:NULL]; expect(tree).notTo(beNil()); - - expect(@([database containsObjectWithOID:entry.OID])).to(beTruthy()); }); it(@"should be possible to write a builder to a repository", ^{ From 4f39f5fffa5d60df86ebb3395914c0236c8b976e Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Tue, 22 Mar 2016 10:51:03 +0800 Subject: [PATCH 052/228] Update libgit2 to include Xcode 7.3 fix --- External/libgit2 | 2 +- ObjectiveGit/GTRepository+RemoteOperations.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/External/libgit2 b/External/libgit2 index c27b4afcd..661db4f48 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit c27b4afcdd80f5a45d7120044bf3d78272181abb +Subproject commit 661db4f4829a0fe1330f275de6e58c34589f512f diff --git a/ObjectiveGit/GTRepository+RemoteOperations.m b/ObjectiveGit/GTRepository+RemoteOperations.m index a03cbe28f..84716d495 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.m +++ b/ObjectiveGit/GTRepository+RemoteOperations.m @@ -226,7 +226,7 @@ - (BOOL)pushRefspecs:(NSArray *)refspecs toRemote:(GTRemote *)remote withOptions remote_callbacks.push_transfer_progress = GTRemotePushTransferProgressCallback; remote_callbacks.payload = &connectionInfo, - gitError = git_remote_connect(remote.git_remote, GIT_DIRECTION_PUSH, &remote_callbacks); + gitError = git_remote_connect(remote.git_remote, GIT_DIRECTION_PUSH, &remote_callbacks, NULL); if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to connect remote"]; return NO; From a3763e44bf0afa8962b2769024b464f393f31520 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Wed, 23 Mar 2016 22:50:20 -0600 Subject: [PATCH 053/228] Pin Quick and Nimble to commits on master - Quick 0.9.1+ - Nimble 3.2.0+ These resolve many deprecation warnings with Swift 2.2 in Xcode 7.3 --- Cartfile.private | 4 ++-- Cartfile.resolved | 4 ++-- Carthage/Checkouts/Nimble | 2 +- Carthage/Checkouts/Quick | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cartfile.private b/Cartfile.private index 6e6efae93..6b5831436 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,4 +1,4 @@ github "jspahrsummers/xcconfigs" >= 0.7.1 -github "Quick/Quick" ~> 0.9.1 -github "Quick/Nimble" ~> 3.1 +github "Quick/Quick" "3a1d88fb81476001c62f086dbd94bb0f5354f1a3" +github "Quick/Nimble" "758cc9b80e0978d7b86b7729f90cd52ee270cb02" github "ZipArchive/ZipArchive" ~> 1.1 diff --git a/Cartfile.resolved b/Cartfile.resolved index b3fea9146..65a6443fe 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ -github "Quick/Nimble" "v3.1.0" -github "Quick/Quick" "v0.9.1" +github "Quick/Nimble" "758cc9b80e0978d7b86b7729f90cd52ee270cb02" +github "Quick/Quick" "3a1d88fb81476001c62f086dbd94bb0f5354f1a3" github "ZipArchive/ZipArchive" "v1.1" github "jspahrsummers/xcconfigs" "0.9" diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble index 72878d662..758cc9b80 160000 --- a/Carthage/Checkouts/Nimble +++ b/Carthage/Checkouts/Nimble @@ -1 +1 @@ -Subproject commit 72878d6622cf8362d3507cd2e3d341b06580f451 +Subproject commit 758cc9b80e0978d7b86b7729f90cd52ee270cb02 diff --git a/Carthage/Checkouts/Quick b/Carthage/Checkouts/Quick index 2f037560b..3a1d88fb8 160000 --- a/Carthage/Checkouts/Quick +++ b/Carthage/Checkouts/Quick @@ -1 +1 @@ -Subproject commit 2f037560be197f0f5ae992512549bc29fabb3818 +Subproject commit 3a1d88fb81476001c62f086dbd94bb0f5354f1a3 From 47921669a7246755e1a1ebf6aa546f0726d5d37c Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sat, 2 Apr 2016 10:19:51 -0600 Subject: [PATCH 054/228] Remove __attribute__((objc_precise_lifetime)) from tests --- ObjectiveGitTests/GTOIDSpec.m | 2 +- ObjectiveGitTests/GTSignatureSpec.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ObjectiveGitTests/GTOIDSpec.m b/ObjectiveGitTests/GTOIDSpec.m index 3f301caa9..a2aa43ab5 100644 --- a/ObjectiveGitTests/GTOIDSpec.m +++ b/ObjectiveGitTests/GTOIDSpec.m @@ -48,7 +48,7 @@ const git_oid *git_oid = NULL; { - GTOID *testOID __attribute__((objc_precise_lifetime)) = [[GTOID alloc] initWithSHA:testSHA]; + GTOID *testOID = [[GTOID alloc] initWithSHA:testSHA]; git_oid = testOID.git_oid; } diff --git a/ObjectiveGitTests/GTSignatureSpec.m b/ObjectiveGitTests/GTSignatureSpec.m index 266f07295..86dce667c 100644 --- a/ObjectiveGitTests/GTSignatureSpec.m +++ b/ObjectiveGitTests/GTSignatureSpec.m @@ -49,7 +49,7 @@ const git_signature *git_signature = NULL; { - GTSignature *testSignature __attribute__((objc_precise_lifetime)) = [[GTSignature alloc] initWithName:name email:email time:time]; + GTSignature *testSignature = [[GTSignature alloc] initWithName:name email:email time:time]; git_signature = testSignature.git_signature; } From 6f802a4b82c634f115b7f941d697ccee3f557a8b Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sun, 3 Apr 2016 13:01:45 -0600 Subject: [PATCH 055/228] Overhaul cibuild - Replaced xctool with xcodebuild + xcpretty - Removed unused cruft and awk scripts --- script/LICENSE.md | 18 ---- script/README.md | 82 ---------------- script/cibuild | 220 ++++++++++++------------------------------ script/schemes.awk | 10 -- script/targets.awk | 12 --- script/xcodebuild.awk | 35 ------- script/xctool.awk | 25 ----- 7 files changed, 63 insertions(+), 339 deletions(-) delete mode 100644 script/LICENSE.md delete mode 100644 script/README.md delete mode 100644 script/schemes.awk delete mode 100644 script/targets.awk delete mode 100644 script/xcodebuild.awk delete mode 100644 script/xctool.awk diff --git a/script/LICENSE.md b/script/LICENSE.md deleted file mode 100644 index 8d9238408..000000000 --- a/script/LICENSE.md +++ /dev/null @@ -1,18 +0,0 @@ -**Copyright (c) 2013 Justin Spahr-Summers** - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/script/README.md b/script/README.md deleted file mode 100644 index f66206fb3..000000000 --- a/script/README.md +++ /dev/null @@ -1,82 +0,0 @@ -# objc-build-scripts - -This project is a collection of scripts created with two goals: - - 1. To standardize how Objective-C projects are bootstrapped after cloning - 1. To easily build Objective-C projects on continuous integration servers - -## Scripts - -Right now, there are two important scripts: [`bootstrap`](#bootstrap) and -[`cibuild`](#cibuild). Both are Bash scripts, to maximize compatibility and -eliminate pesky system configuration issues (like setting up a working Ruby -environment). - -The structure of the scripts on disk is meant to follow that of a typical Ruby -project: - -``` -script/ - bootstrap - cibuild -``` - -### bootstrap - -This script is responsible for bootstrapping (initializing) your project after -it's been checked out. Here, you should install or clone any dependencies that -are required for a working build and development environment. - -By default, the script will verify that [xctool][] is installed, then initialize -and update submodules recursively. If any submodules contain `script/bootstrap`, -that will be run as well. - -To check that other tools are installed, you can set the `REQUIRED_TOOLS` -environment variable before running `script/bootstrap`, or edit it within the -script directly. Note that no installation is performed automatically, though -this can always be added within your specific project. - -### cibuild - -This script is responsible for building the project, as you would want it built -for continuous integration. This is preferable to putting the logic on the CI -server itself, since it ensures that any changes are versioned along with the -source. - -By default, the script will run [`bootstrap`](#bootstrap), look for any Xcode -workspace or project in the working directory, then build all targets/schemes -(as found by `xcodebuild -list`) using [xctool][]. - -You can also specify the schemes to build by passing them into the script: - -```sh -script/cibuild ReactiveCocoa-Mac ReactiveCocoa-iOS -``` - -As with the `bootstrap` script, there are several environment variables that can -be used to customize behavior. They can be set on the command line before -invoking the script, or the defaults changed within the script directly. - -## Getting Started - -To add the scripts to your project, read the contents of this repository into -a `script` folder: - -``` -$ git remote add objc-build-scripts https://github.com/jspahrsummers/objc-build-scripts.git -$ git fetch objc-build-scripts -$ git read-tree --prefix=script/ -u objc-build-scripts/master -``` - -Then commit the changes, to incorporate the scripts into your own repository's -history. You can also freely tweak the scripts for your specific project's -needs. - -To merge in upstream changes later: - -``` -$ git fetch -p objc-build-scripts -$ git merge --ff --squash -Xsubtree=script objc-build-scripts/master -``` - -[xctool]: https://github.com/facebook/xctool diff --git a/script/cibuild b/script/cibuild index 19a764840..0468f2a55 100755 --- a/script/cibuild +++ b/script/cibuild @@ -1,170 +1,76 @@ #!/bin/bash +# +# script/cibuild +# ObjectiveGit +# +# Executes the build and runs tests for Mac and iOS. Designed to be invoked by +# Travis as a matrix build so that the two platform builds can run in parallel. +# +# Dependent tools & scripts: +# - script/bootstrap +# - script/update_libssl_ios +# - [xcodebuild](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html) +# - xcpretty (gem) +# - xcpretty-travis-formatter (gem) +# +# Environment Variables: +# - SCHEME: specifies which Xcode scheme to build. Set to one of the following: +# - ObjectiveGit Mac +# - ObjectiveGit iOS +# - TRAVIS: indicates when the build is being run by travis, used to invoke +# the xcpretty-travis-formatter gem for output. + +if [ -z "$SCHEME" ]; then + echo "The SCHEME environment variable is empty. Please set this to one of:" + echo "- ObjectiveGit Mac" + echo "- ObjectiveGit iOS" + exit 1 +fi -export SCRIPT_DIR=$(dirname "$0") ## ## Configuration Variables ## -SCHEMES="$@" +SCRIPT_DIR=$(dirname "$0") +XCWORKSPACE="ObjectiveGitFramework.xcworkspace" +XCODE_OPTIONS=$(RUN_CLANG_STATIC_ANALYZER=NO ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO) -config () -{ - # The workspace to build. - # - # If not set and no workspace is found, the -workspace flag will not be passed - # to `xctool`. - # - # Only one of `XCWORKSPACE` and `XCODEPROJ` needs to be set. The former will - # take precedence. - : ${XCWORKSPACE=$(find_pattern "*.xcworkspace")} - - # The project to build. - # - # If not set and no project is found, the -project flag will not be passed - # to `xctool`. - # - # Only one of `XCWORKSPACE` and `XCODEPROJ` needs to be set. The former will - # take precedence. - : ${XCODEPROJ=$(find_pattern "*.xcodeproj")} - - # A bootstrap script to run before building. - # - # If this file does not exist, it is not considered an error. - : ${BOOTSTRAP="$SCRIPT_DIR/bootstrap"} - - # Extra options to pass to xctool. - : ${XCTOOL_OPTIONS="RUN_CLANG_STATIC_ANALYZER=NO"} - - # A whitespace-separated list of default schemes to build. - # - # Individual names can be quoted to avoid word splitting. - : ${SCHEMES:=$(xcodebuild -list -project "$XCODEPROJ" 2>/dev/null | awk -f "$SCRIPT_DIR/schemes.awk")} - - export XCWORKSPACE - export XCODEPROJ - export BOOTSTRAP - export XCTOOL_OPTIONS - export SCHEMES -} +if [ -n "$TRAVIS" ]; then + # Use a special formatter when running on TravisCI + XCPRETTY_FORMAT_OPTIONS="-f `xcpretty-travis-formatter`" +else + XCPRETTY_FORMAT_OPTIONS="--color" +fi ## ## Build Process ## -main () -{ - config - - if [ -f "$BOOTSTRAP" ] - then - echo "*** Bootstrapping..." - "$BOOTSTRAP" || exit $? - fi - - if [ "$SCHEME" == "ObjectiveGit iOS" ] - then - echo "*** Prebuilding OpenSSL" - $SCRIPT_DIR/update_libssl_ios - fi - - if [ -z "${SCHEME+x}" ] && [ "${#SCHEME[@]}" = 0 ] - then - echo "*** The following schemes will be built:" - echo "$SCHEMES" | xargs -n 1 echo " " - echo - - echo "$SCHEMES" | xargs -n 1 | ( - local status=0 - - while read scheme - do - build_scheme "$scheme" || status=1 - done - - exit $status - ) - else - echo "*** The following scheme will be built $SCHEME" - local status=0 - build_scheme "$SCHEME" || status=1 - exit $status - fi -} - -find_pattern () -{ - ls -d $1 2>/dev/null | head -n 1 -} - -run_xctool () -{ - if [ -n "$XCWORKSPACE" ] - then - xctool -workspace "$XCWORKSPACE" $XCTOOL_OPTIONS "$@" \ - ONLY_ACTIVE_ARCH=NO \ - CODE_SIGN_IDENTITY="" \ - CODE_SIGNING_REQUIRED=NO 2>&1 - elif [ -n "$XCODEPROJ" ] - then - xctool -project "$XCODEPROJ" $XCTOOL_OPTIONS "$@" \ - ONLY_ACTIVE_ARCH=NO \ - CODE_SIGN_IDENTITY="" \ - CODE_SIGNING_REQUIRED=NO 2>&1 - else - echo "*** No workspace or project file found." - exit 1 - fi -} - -parse_build () -{ - awk -f "$SCRIPT_DIR/xctool.awk" 2>&1 >/dev/null -} - -build_scheme () -{ - local scheme=$1 - - echo "*** Building and testing $scheme..." - echo - - local sdkflags=() - local action=test - - # Determine whether we can run unit tests for this target. - run_xctool -scheme "$scheme" run-tests | parse_build - - local awkstatus=$? - - if [ "$awkstatus" -eq "1" ] - then - # SDK not found, try for iphonesimulator. - sdkflags=(-sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 5") - - # Determine whether the unit tests will run with iphonesimulator - run_xctool "${sdkflags[@]}" -scheme "$scheme" run-tests | parse_build - - awkstatus=$? - - if [ "$awkstatus" -ne "0" ] - then - # Unit tests will not run on iphonesimulator. - sdkflags=() - fi - fi - - if [ "$awkstatus" -ne "0" ] - then - # Unit tests aren't supported. - action=build - fi - - run_xctool "${sdkflags[@]}" -scheme "$scheme" $action -} - -export -f build_scheme -export -f run_xctool -export -f parse_build - -main +echo "*** Bootstrapping..." +"$SCRIPT_DIR/bootstrap" + +if [ "$SCHEME" == "ObjectiveGit Mac" ]; then + echo "*** Building and testing $SCHEME..." + echo + + xcodebuild -workspace "$XCWORKSPACE" \ + -scheme "$SCHEME" \ + ${XCODE_OPTIONS[*]} \ + build test \ + 2>&1 | xcpretty $XCPRETTY_FORMAT_OPTIONS +elif [ "$SCHEME" == "ObjectiveGit iOS" ]; then + echo "*** Prebuilding OpenSSL" + "$SCRIPT_DIR/update_libssl_ios" + + echo "*** Building and testing $SCHEME..." + echo + + xcodebuild -workspace "$XCWORKSPACE" \ + -scheme "$SCHEME" \ + -destination "platform=iOS Simulator,name=iPhone 5" \ + -sdk iphonesimulator \ + ${XCODE_OPTIONS[*]} \ + build test \ + 2>&1 | xcpretty $XCPRETTY_FORMAT_OPTIONS +fi diff --git a/script/schemes.awk b/script/schemes.awk deleted file mode 100644 index 4c94df914..000000000 --- a/script/schemes.awk +++ /dev/null @@ -1,10 +0,0 @@ -BEGIN { - FS = "\n"; -} - -/Schemes:/ { - while (getline && $0 != "") { - sub(/^ +/, ""); - print "'" $0 "'"; - } -} diff --git a/script/targets.awk b/script/targets.awk deleted file mode 100644 index 117660dcd..000000000 --- a/script/targets.awk +++ /dev/null @@ -1,12 +0,0 @@ -BEGIN { - FS = "\n"; -} - -/Targets:/ { - while (getline && $0 != "") { - if ($0 ~ /Tests/) continue; - - sub(/^ +/, ""); - print "'" $0 "'"; - } -} diff --git a/script/xcodebuild.awk b/script/xcodebuild.awk deleted file mode 100644 index c746b09aa..000000000 --- a/script/xcodebuild.awk +++ /dev/null @@ -1,35 +0,0 @@ -# Exit statuses: -# -# 0 - No errors found. -# 1 - Build or test failure. Errors will be logged automatically. -# 2 - Untestable target. Retry with the "build" action. - -BEGIN { - status = 0; -} - -{ - print; - fflush(stdout); -} - -/is not valid for Testing/ { - exit 2; -} - -/[0-9]+: (error|warning):/ { - errors = errors $0 "\n"; -} - -/(TEST|BUILD) FAILED/ { - status = 1; -} - -END { - if (length(errors) > 0) { - print "\n*** All errors:\n" errors; - } - - fflush(stdout); - exit status; -} diff --git a/script/xctool.awk b/script/xctool.awk deleted file mode 100644 index f6132589d..000000000 --- a/script/xctool.awk +++ /dev/null @@ -1,25 +0,0 @@ -# Exit statuses: -# -# 0 - No errors found. -# 1 - Wrong SDK. Retry with SDK `iphonesimulator`. -# 2 - Missing target. - -BEGIN { - status = 0; -} - -{ - print; -} - -/Testing with the '(.+)' SDK is not yet supported/ { - status = 1; -} - -/does not contain a target named/ { - status = 2; -} - -END { - exit status; -} From 29f5a531e9c8095862bbafe8901741b0e2498c5f Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Mon, 4 Apr 2016 20:27:57 -0600 Subject: [PATCH 056/228] Install xcpretty on travis Also enabled fast_finish for builds --- .travis.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3f53414e7..446f85e41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,17 @@ osx_image: xcode7 language: objective-c matrix: + fast_finish: true: include: - osx_image: xcode7 - env: SCHEME="ObjectiveGit Mac" - - osx_image: xcode7 - env: SCHEME="ObjectiveGit iOS" + env: + - SCHEME="ObjectiveGit Mac" + - osx_image: xcode7.3 + env: + - SCHEME="ObjectiveGit iOS" before_install: - - brew update - - brew outdated xctool || brew upgrade xctool + - gem install xcpretty + - gem install xcpretty-travis-formatter install: script/bootstrap script: script/cibuild notifications: From 9145b0ab21e7fdc55fd743b9ac8af8a3d97d23f2 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Mon, 4 Apr 2016 20:28:17 -0600 Subject: [PATCH 057/228] Update list of required tools on readme --- README.md | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 95afc81f5..db22e4241 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ A brief summary of the available functionality: Not all libgit2 features are available, but if you run across something missing, please consider [contributing a pull request](#contributing)! -Many classes in the ObjectiveGit API wrap a C struct from libgit2 and expose the underlying data and operations using Cocoa idioms. The underlying libgit2 types are prefixed with `git_` and are often accessible via a property so that your application can take advantage of the libgit2 API directly. +Many classes in the ObjectiveGit API wrap a C struct from libgit2 and expose the underlying data and operations using Cocoa idioms. The underlying libgit2 types are prefixed with `git_` and are often accessible via a property so that your application can take advantage of the [libgit2 API](https://libgit2.github.com/libgit2/#HEAD) directly. The ObjectiveGit API makes extensive use of the Cocoa NSError pattern. The public API is also decorated with nullability attributes so that you will get compile-time feedback of whether nil is allowed or not. This also makes the framework much nicer to use in Swift. @@ -32,15 +32,18 @@ or download them [manually](#manually). ### Other Tools -To start building the framework, you must install the required dependencies, -[xctool](https://github.com/facebook/xctool) and -[cmake](https://github.com/Kitware/CMake). We recommend using -[Homebrew](http://brew.sh) to install these tools. - -Once you have the dependencies you should clone this repository and then run [`script/bootstrap`](script/bootstrap). This will automatically pull down and install any other -dependencies. - -Note that the `bootstrap` script automatically installs some libraries that ObjectiveGit relies upon, using Homebrew. If you not want to use Homebrew, you will need to ensure these dependent libraries and their headers are installed where the build scripts [expect them to be](https://github.com/libgit2/objective-git/blob/master/script/bootstrap#L80-L99). +Simply run the [`script/bootstrap`](script/bootstrap) script to automatically install +dependencies needed to start building the framework. This script uses +[Homebrew](http://brew.sh) to install these tools. If your Mac does not have +Homebrew, you will need to install the following manually: + +- [cmake](https://github.com/Kitware/CMake) +- libtool +- autoconf +- automake +- pkg-config +- libssh2 + - symlinks: lib/libssh2.a include/libssh2.h include/libssh2_sftp.h include/libssh2_publickey.h To develop ObjectiveGit on its own, open the `ObjectiveGitFramework.xcworkspace` file. From f434994cab1d29741e7e882e3c911376d1865f94 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Mon, 4 Apr 2016 21:51:19 -0600 Subject: [PATCH 058/228] Fix fast_finish in travis file --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 446f85e41..a6f41649c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ osx_image: xcode7 language: objective-c matrix: - fast_finish: true: + fast_finish: true include: - osx_image: xcode7 env: From 7813f12c75381d87d5ab345c591d00f7184ab150 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Mon, 4 Apr 2016 22:19:42 -0600 Subject: [PATCH 059/228] Configure cibuild to echo commands and fail on first error --- script/cibuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/cibuild b/script/cibuild index 0468f2a55..647cf9d38 100755 --- a/script/cibuild +++ b/script/cibuild @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -ex # # script/cibuild # ObjectiveGit From f250c3dd8330732d27b49af93a7defae6df0629e Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Mon, 4 Apr 2016 22:32:04 -0600 Subject: [PATCH 060/228] Enable pipefail --- script/cibuild | 1 + 1 file changed, 1 insertion(+) diff --git a/script/cibuild b/script/cibuild index 647cf9d38..4f2a1a356 100755 --- a/script/cibuild +++ b/script/cibuild @@ -32,6 +32,7 @@ fi ## Configuration Variables ## +set -o pipefail SCRIPT_DIR=$(dirname "$0") XCWORKSPACE="ObjectiveGitFramework.xcworkspace" XCODE_OPTIONS=$(RUN_CLANG_STATIC_ANALYZER=NO ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO) From ede649ff9333319cefd44fe960a89e1dd3544265 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Tue, 5 Apr 2016 18:31:07 -0600 Subject: [PATCH 061/228] Fix osx_image for Mac build --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a6f41649c..9a6bf09bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: objective-c matrix: fast_finish: true include: - - osx_image: xcode7 + - osx_image: xcode7.3 env: - SCHEME="ObjectiveGit Mac" - osx_image: xcode7.3 From 02611548213963a5ae3ecb9eab0c32243207084f Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Tue, 5 Apr 2016 20:55:38 -0600 Subject: [PATCH 062/228] Nimble 4.0 --- Cartfile.private | 2 +- Cartfile.resolved | 2 +- Carthage/Checkouts/Nimble | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cartfile.private b/Cartfile.private index 6b5831436..eff4b0401 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,4 +1,4 @@ github "jspahrsummers/xcconfigs" >= 0.7.1 github "Quick/Quick" "3a1d88fb81476001c62f086dbd94bb0f5354f1a3" -github "Quick/Nimble" "758cc9b80e0978d7b86b7729f90cd52ee270cb02" +github "Quick/Nimble" ~> 4.0 github "ZipArchive/ZipArchive" ~> 1.1 diff --git a/Cartfile.resolved b/Cartfile.resolved index 65a6443fe..04db32222 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ -github "Quick/Nimble" "758cc9b80e0978d7b86b7729f90cd52ee270cb02" +github "Quick/Nimble" "v4.0.0" github "Quick/Quick" "3a1d88fb81476001c62f086dbd94bb0f5354f1a3" github "ZipArchive/ZipArchive" "v1.1" github "jspahrsummers/xcconfigs" "0.9" diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble index 758cc9b80..29f7fb373 160000 --- a/Carthage/Checkouts/Nimble +++ b/Carthage/Checkouts/Nimble @@ -1 +1 @@ -Subproject commit 758cc9b80e0978d7b86b7729f90cd52ee270cb02 +Subproject commit 29f7fb3732893f76fa851cb37b0c4b339c49cead From 4050ece611c8a628e30e9a628f95dcbe4c86f62a Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Thu, 7 Apr 2016 21:04:39 -0600 Subject: [PATCH 063/228] Remove iOS 9.0 deployment target from tests Falling back to default of iOS 8.0 --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 5834b6b40..731423e35 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -2235,7 +2235,6 @@ GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( ., @@ -2281,7 +2280,6 @@ GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( ., @@ -2328,7 +2326,6 @@ GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( ., @@ -2375,7 +2372,6 @@ GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( ., From e19fcc4db218c125196c5c6f004eee469bbe018d Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sun, 10 Apr 2016 20:16:48 -0600 Subject: [PATCH 064/228] Quick 0.9.2 --- Cartfile.private | 2 +- Cartfile.resolved | 2 +- Carthage/Checkouts/Quick | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cartfile.private b/Cartfile.private index eff4b0401..d7373ca9f 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,4 +1,4 @@ github "jspahrsummers/xcconfigs" >= 0.7.1 -github "Quick/Quick" "3a1d88fb81476001c62f086dbd94bb0f5354f1a3" +github "Quick/Quick" ~> 0.9.2 github "Quick/Nimble" ~> 4.0 github "ZipArchive/ZipArchive" ~> 1.1 diff --git a/Cartfile.resolved b/Cartfile.resolved index 04db32222..b67d877a6 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ github "Quick/Nimble" "v4.0.0" -github "Quick/Quick" "3a1d88fb81476001c62f086dbd94bb0f5354f1a3" +github "Quick/Quick" "v0.9.2" github "ZipArchive/ZipArchive" "v1.1" github "jspahrsummers/xcconfigs" "0.9" diff --git a/Carthage/Checkouts/Quick b/Carthage/Checkouts/Quick index 3a1d88fb8..dc2b4b75d 160000 --- a/Carthage/Checkouts/Quick +++ b/Carthage/Checkouts/Quick @@ -1 +1 @@ -Subproject commit 3a1d88fb81476001c62f086dbd94bb0f5354f1a3 +Subproject commit dc2b4b75d2f718518acbdef289a72fad77975a8a From fbc6bb0c42c3f35725fbe98db4e537e22c9a3aed Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Mon, 11 Apr 2016 09:40:00 -0600 Subject: [PATCH 065/228] Add clean_externals script --- script/clean_externals | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 script/clean_externals diff --git a/script/clean_externals b/script/clean_externals new file mode 100755 index 000000000..a25b6c530 --- /dev/null +++ b/script/clean_externals @@ -0,0 +1,22 @@ +#!/bin/bash -ex + +# +# clean_externals +# ObjectiveGit +# +# Removes the outputs from the various static library targets. +# Necessary when switching platforms/architectures as Xcode does not clean +# these for you. +# + +# A list of external static libraries included in the SwiftGit2 framework +libraries=( + External/libgit2.a + External/libgit2-ios/libgit2-ios.a + External/libssh2-ios/lib/libssh2-ios.a + External/ios-openssl/lib/libssl.a + External/ios-openssl/lib/libcrypto.a + External/ios-openssl/include +) + +rm -vrf "${libraries[@]}" From 63db18b53a85ba9ae819babc923f68977c6f4aaf Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Fri, 15 Apr 2016 15:06:46 +0700 Subject: [PATCH 066/228] Use libgit2 0.24.1 --- External/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libgit2 b/External/libgit2 index 661db4f48..211e117a0 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit 661db4f4829a0fe1330f275de6e58c34589f512f +Subproject commit 211e117a0590583a720c53172406f34186c543bd From 47dc0fc462d1cfb2a2ca1e730f2f9bf27bb0545a Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Thu, 19 May 2016 15:16:31 +0300 Subject: [PATCH 067/228] Git notes support. Added `GTNote` class and a few helpers into `GTRepository`. --- ObjectiveGit/GTNote.h | 63 ++++++++++++++ ObjectiveGit/GTNote.m | 75 ++++++++++++++++ ObjectiveGit/GTRepository.h | 43 ++++++++++ ObjectiveGit/GTRepository.m | 73 ++++++++++++++++ ObjectiveGit/ObjectiveGit.h | 1 + .../project.pbxproj | 20 +++++ ObjectiveGitTests/GTNoteSpec.m | 86 +++++++++++++++++++ 7 files changed, 361 insertions(+) create mode 100644 ObjectiveGit/GTNote.h create mode 100644 ObjectiveGit/GTNote.m create mode 100644 ObjectiveGitTests/GTNoteSpec.m diff --git a/ObjectiveGit/GTNote.h b/ObjectiveGit/GTNote.h new file mode 100644 index 000000000..ef0f1de4c --- /dev/null +++ b/ObjectiveGit/GTNote.h @@ -0,0 +1,63 @@ +// +// GTNote.h +// ObjectiveGitFramework +// +// Created by Slava Karpenko on 5/16/2016. +// +// The MIT License +// +// Copyright (c) 2016 Wildbit LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +#import +#import "git2/oid.h" + +@class GTSignature; +@class GTRepository; +@class GTOID; +@class GTObject; + +NS_ASSUME_NONNULL_BEGIN + +@interface GTNote : NSObject {} + +/// The author of the note. +@property (nonatomic, readonly, strong, nullable) GTSignature *author; + +/// The committer of the note. +@property (nonatomic, readonly, strong, nullable) GTSignature *committer; + +/// Content of the note. +@property (nonatomic, readonly, strong) NSString *note; + +@property (nonatomic, readonly, strong) GTObject *target; + +/// The underlying `git_note` object. +- (git_note * _Nullable)git_note __attribute__((objc_returns_inner_pointer)); + +/// These initializers may fail if there's no note attached to the provided oid. +- (nullable instancetype)initWithTargetOID:(GTOID*)oid repository:(GTRepository*)repository ref:(nullable NSString*)ref; +- (nullable instancetype)initWithTargetGitOID:(git_oid*)oid repository:(git_repository *)repository ref:(const char* _Nullable)ref; + +@end + +NS_ASSUME_NONNULL_END + diff --git a/ObjectiveGit/GTNote.m b/ObjectiveGit/GTNote.m new file mode 100644 index 000000000..76d4ee9af --- /dev/null +++ b/ObjectiveGit/GTNote.m @@ -0,0 +1,75 @@ +// +// GTNote.m +// ObjectiveGitFramework +// +// Created by Slava Karpenko on 16.05.16. +// Copyright © 2016 Wildbit LLC. All rights reserved. +// + +#import "GTNote.h" +#import "NSError+Git.h" +#import "GTSignature.h" +#import "GTReference.h" +#import "GTRepository.h" +#import "NSString+Git.h" +#import "GTOID.h" + +#import "git2/errors.h" +#import "git2/notes.h" + +@interface GTNote () +{ + git_note *_note; +} + +@end +@implementation GTNote + +- (NSString *)description { + return [NSString stringWithFormat:@"<%@: %p>", NSStringFromClass([self class]), self]; +} + +#pragma mark API + +- (void)dealloc { + if (_note != NULL) { + git_note_free(_note); + } +} + +- (git_note *)git_note { + return _note; +} + +- (NSString*)note { + return @(git_note_message(self.git_note)); +} + +- (GTSignature *)author { + return [[GTSignature alloc] initWithGitSignature:git_note_author(self.git_note)]; +} + +- (GTSignature *)committer { + return [[GTSignature alloc] initWithGitSignature:git_note_committer(self.git_note)]; +} + +- (GTOID*)targetOID { + return [GTOID oidWithGitOid:git_note_id(self.git_note)]; +} + +- (instancetype)initWithTargetOID:(GTOID*)oid repository:(GTRepository*)repository ref:(NSString*)ref { + return [self initWithTargetGitOID:(git_oid *)oid.git_oid repository:repository.git_repository ref:ref.UTF8String]; +} + +- (instancetype)initWithTargetGitOID:(git_oid*)oid repository:(git_repository *)repository ref:(const char*)ref { + if (self = [super init]) { + int gitErr = git_note_read(&_note, repository, ref, oid); + + if (gitErr != GIT_OK) + return nil; // Cannot read the note, means it either doesn't exists for this object, this object is not found, or whatever else. + } + + return self; +} + +@end diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index 45f3caead..e73e84c6c 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -51,6 +51,7 @@ @class GTTag; @class GTTree; @class GTRemote; +@class GTNote; NS_ASSUME_NONNULL_BEGIN @@ -604,6 +605,48 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// Returns YES if operation was successful, NO otherwise - (BOOL)cleanupStateWithError:(NSError **)error; +/// Creates a new note in this repo (using a default notes reference, e.g. "refs/notes/commits") +/// +/// note - Note text. +/// theTarget - Object (usually a commit) to which this note attaches to. +/// This object must belong to this repository. +/// ref - Name for the notes reference in the repo, or nil for default ("refs/notes/commits") +/// author - Signature of the author for this note, and +/// of the note creation time +/// committer - Signature of the committer for this note. +/// overwrite - If set to YES, the note will be overwritten if it already exists. +/// error - Will be filled with a NSError object in case of error. +/// May be NULL. +/// +/// Returns the newly created note or nil on error. +- (nullable GTNote *)createNote:(NSString *)note target:(GTObject *)theTarget ref:(nullable NSString *)ref author:(GTSignature *)author committer:(GTSignature *)committer overwriteIfExists:(BOOL)overwrite error:(NSError **)error; + +/// Removes a note attached to object in this repo (using a default notes reference, e.g. "refs/notes/commits") +/// +/// parentObject - Object (usually a commit) to which the note to be removed is attached to. +/// This object must belong to this repository. +/// ref - Name for the notes reference in the repo, or nil for default ("refs/notes/commits") +/// author - Signature of the author for this note removal, and +/// of the note removal time +/// committer - Signature of the committer for this note removal. +/// error - Will be filled with a NSError object in case of error. +/// May be NULL. +/// +/// Returns the YES on success and NO on error. +- (BOOL)removeNoteFromObject:(GTObject *)parentObject ref:(nullable NSString *)ref author:(GTSignature *)author committer:(GTSignature *)committer error:(NSError **)error; + +/// Enumerates through all stored notes in this repo (using a default notes reference, e.g. "refs/notes/commits") +/// +/// error - Will be filled with a NSError object in case of error. +/// May be null. +/// ref - Name for the notes reference in the repo, or nil for default ("refs/notes/commits") +/// block - A block to be called on each encountered note object. The block accepts +/// a reference to `note`, an `object` that is annotated with the note. +/// If the block sets `stop` to YES, the iterator is finished. +/// +/// Returns YES on overall success or NO on error of any kind. +- (BOOL)enumerateNotesWithError:(NSError **)error ref:(nullable NSString *)ref usingBlock:(void (^)(GTNote *note, GTObject *object, BOOL *stop))block; + @end NS_ASSUME_NONNULL_END diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index c2483ab57..749737845 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -52,6 +52,7 @@ #import "NSError+Git.h" #import "NSString+Git.h" #import "GTRepository+References.h" +#import "GTNote.h" #import "git2.h" @@ -919,4 +920,76 @@ - (BOOL)cleanupStateWithError:(NSError * _Nullable __autoreleasing *)error { return YES; } +#pragma mark Notes + +- (GTNote *)createNote:(NSString *)note target:(GTObject *)theTarget ref:(NSString *)ref author:(GTSignature *)author committer:(GTSignature *)committer overwriteIfExists:(BOOL)overwrite error:(NSError **)error { + git_oid oid; + + int gitError = git_note_create(&oid, self.git_repository, ref.UTF8String, author.git_signature, committer.git_signature, theTarget.OID.git_oid, [note UTF8String], overwrite ? 1 : 0); + if (gitError != GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to create a note in repository"]; + + return nil; + } + + return [[GTNote alloc] initWithTargetOID:theTarget.OID repository:self ref:ref]; +} + +- (BOOL)removeNoteFromObject:(GTObject *)parentObject ref:(NSString *)ref author:(GTSignature *)author committer:(GTSignature *)committer error:(NSError **)error { + int gitError = git_note_remove(self.git_repository, ref.UTF8String, author.git_signature, committer.git_signature, parentObject.OID.git_oid); + if (gitError != GIT_OK) { + if(error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to delete note from %@", parentObject]; + return NO; + } + + return YES; +} + +- (BOOL)enumerateNotesWithError:(NSError **)error ref:(NSString *)ref usingBlock:(void (^)(GTNote *note, GTObject *object, BOOL *stop))block +{ + git_note_iterator* iter = NULL; + + int gitError = git_note_iterator_new(&iter, self.git_repository, ref.UTF8String); + + if (gitError != GIT_OK) + { + if(error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to enumerate notes"]; + return NO; + } + + git_oid note_id; + git_oid object_id; + BOOL success = YES; + + while (git_note_next(¬e_id, &object_id, iter) == GIT_OK) { + NSError* lookupErr = nil; + + GTNote* note = [[GTNote alloc] initWithTargetGitOID:&object_id repository:self.git_repository ref:ref.UTF8String]; + if (note == nil) { + if (error != NULL) + *error = [NSError git_errorFor:GIT_ENOTFOUND description:@"Cannot create note"]; + success = NO; + break; + } + + GTObject* obj = [self lookUpObjectByGitOid:&object_id error:&lookupErr]; + if (obj == nil && lookupErr != nil) { + if (error != NULL) + *error = lookupErr; + success = NO; + break; + } + + BOOL stop = NO; + block(note, obj, &stop); + if (stop) { + break; + } + } + + git_note_iterator_free(iter); + + return success; +} + @end diff --git a/ObjectiveGit/ObjectiveGit.h b/ObjectiveGit/ObjectiveGit.h index 8054e3878..4efa0e81f 100644 --- a/ObjectiveGit/ObjectiveGit.h +++ b/ObjectiveGit/ObjectiveGit.h @@ -70,6 +70,7 @@ FOUNDATION_EXPORT const unsigned char ObjectiveGitVersionString[]; #import #import #import +#import #import #import diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 731423e35..f6e236fc3 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -368,6 +368,13 @@ F8E4A2911A170CA6006485A8 /* GTRemotePushSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8E4A2901A170CA6006485A8 /* GTRemotePushSpec.m */; }; F8E68E731C800B1600DBC517 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8E68E721C800B1600DBC517 /* ZipArchive.framework */; }; F8EFA03A1B4059ED000FF7D0 /* GTUtilityFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0391B4059ED000FF7D0 /* GTUtilityFunctions.m */; }; + F964D5F11CE9D9B200F1D8DD /* GTNote.h in Headers */ = {isa = PBXBuildFile; fileRef = F964D5EF1CE9D9B200F1D8DD /* GTNote.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F964D5F21CE9D9B200F1D8DD /* GTNote.h in Headers */ = {isa = PBXBuildFile; fileRef = F964D5EF1CE9D9B200F1D8DD /* GTNote.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F964D5F31CE9D9B200F1D8DD /* GTNote.m in Sources */ = {isa = PBXBuildFile; fileRef = F964D5F01CE9D9B200F1D8DD /* GTNote.m */; }; + F964D5F51CE9D9B200F1D8DD /* GTNote.m in Sources */ = {isa = PBXBuildFile; fileRef = F964D5F01CE9D9B200F1D8DD /* GTNote.m */; }; + F9D1D4231CEB79D1009E5855 /* GTNoteSpec.m in Resources */ = {isa = PBXBuildFile; fileRef = F9D1D4221CEB79D1009E5855 /* GTNoteSpec.m */; }; + F9D1D4241CEB79D1009E5855 /* GTNoteSpec.m in Resources */ = {isa = PBXBuildFile; fileRef = F9D1D4221CEB79D1009E5855 /* GTNoteSpec.m */; }; + F9D1D4251CEB7BA6009E5855 /* GTNoteSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F9D1D4221CEB79D1009E5855 /* GTNoteSpec.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -644,6 +651,9 @@ F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+PullSpec.m"; sourceTree = ""; }; F8EFA0381B4059ED000FF7D0 /* GTUtilityFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTUtilityFunctions.h; sourceTree = ""; }; F8EFA0391B4059ED000FF7D0 /* GTUtilityFunctions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTUtilityFunctions.m; sourceTree = ""; }; + F964D5EF1CE9D9B200F1D8DD /* GTNote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTNote.h; sourceTree = ""; }; + F964D5F01CE9D9B200F1D8DD /* GTNote.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTNote.m; sourceTree = ""; }; + F9D1D4221CEB79D1009E5855 /* GTNoteSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTNoteSpec.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -823,6 +833,7 @@ 30A269AC17B4878C000FE64E /* GTRepository+StatusSpec.m */, 88E353051982EA6B0051001F /* GTRepositoryAttributesSpec.m */, 4D12323F178E009E0048F785 /* GTRepositoryCommittingSpec.m */, + F9D1D4221CEB79D1009E5855 /* GTNoteSpec.m */, 88234B2518F2FE260039972E /* GTRepositoryResetSpec.m */, D0AC906B172F941F00347DC4 /* GTRepositorySpec.m */, D015F7D417F6965400AD5E1F /* GTRepositoryStashingSpec.m */, @@ -899,6 +910,8 @@ BD6B0416131496CC001909D0 /* GTTreeEntry.m */, 5BE612861745EE3300266D8C /* GTTreeBuilder.h */, 5BE612871745EE3300266D8C /* GTTreeBuilder.m */, + F964D5EF1CE9D9B200F1D8DD /* GTNote.h */, + F964D5F01CE9D9B200F1D8DD /* GTNote.m */, BDD62922131C03D600DE34D1 /* GTTag.h */, BDD62923131C03D600DE34D1 /* GTTag.m */, BDFAF9C1131C1845000508BC /* GTIndex.h */, @@ -1104,6 +1117,7 @@ 88746CC417FA1C950005888A /* GTRepository+Committing.h in Headers */, D09C2E361755F16200065E36 /* GTSubmodule.h in Headers */, F8D1BDEE1B31FE7C00CDEC90 /* GTRepository+Pull.h in Headers */, + F964D5F11CE9D9B200F1D8DD /* GTNote.h in Headers */, 4D79C0EE17DF9F4D00997DE4 /* GTCredential.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1162,6 +1176,7 @@ D01B6F7119F82FB300D411BC /* GTDiffDelta.h in Headers */, D01B6F3B19F82F8700D411BC /* GTTreeBuilder.h in Headers */, D01B6F1B19F82F7B00D411BC /* NSDate+GTTimeAdditions.h in Headers */, + F964D5F21CE9D9B200F1D8DD /* GTNote.h in Headers */, D01B6F6319F82FA600D411BC /* GTFilterList.h in Headers */, 889923FB19FF5DD40092A9A6 /* git2 in Headers */, F8D1BDEF1B31FE7C00CDEC90 /* GTRepository+Pull.h in Headers */, @@ -1300,6 +1315,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + F9D1D4231CEB79D1009E5855 /* GTNoteSpec.m in Resources */, D09C2E51175602A500065E36 /* fixtures.zip in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1316,6 +1332,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + F9D1D4241CEB79D1009E5855 /* GTNoteSpec.m in Resources */, F8D007A81B4FA045009A8DAF /* fixtures.zip in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1386,6 +1403,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + F9D1D4251CEB7BA6009E5855 /* GTNoteSpec.m in Sources */, 23BB67C11C7DF60300A37A66 /* GTRepository+PullSpec.m in Sources */, D0751CD918BE520400134314 /* GTFilterListSpec.m in Sources */, 200578C518932A82001C06C3 /* GTBlameSpec.m in Sources */, @@ -1475,6 +1493,7 @@ 88746CC617FA1C950005888A /* GTRepository+Committing.m in Sources */, D015F7CC17F695E800AD5E1F /* GTRepository+Stashing.m in Sources */, 30B1E7F01703522100D0814D /* NSDate+GTTimeAdditions.m in Sources */, + F964D5F31CE9D9B200F1D8DD /* GTNote.m in Sources */, 8821546B1714740500D76B76 /* GTReflog.m in Sources */, 8821547817147A5200D76B76 /* GTReflogEntry.m in Sources */, 8821547F17147B3600D76B76 /* GTOID.m in Sources */, @@ -1535,6 +1554,7 @@ D01B6F5419F82FA600D411BC /* GTBlameHunk.m in Sources */, D01B6F6819F82FA600D411BC /* GTFetchHeadEntry.m in Sources */, D01B6F3619F82F8700D411BC /* GTBlob.m in Sources */, + F964D5F51CE9D9B200F1D8DD /* GTNote.m in Sources */, D01B6F6E19F82FB300D411BC /* GTDiffFile.m in Sources */, D01B6F5619F82FA600D411BC /* GTReflog.m in Sources */, D01B6F5E19F82FA600D411BC /* GTCredential.m in Sources */, diff --git a/ObjectiveGitTests/GTNoteSpec.m b/ObjectiveGitTests/GTNoteSpec.m new file mode 100644 index 000000000..5b051ba64 --- /dev/null +++ b/ObjectiveGitTests/GTNoteSpec.m @@ -0,0 +1,86 @@ +// +// GTNoteSpec.m +// ObjectiveGitFramework +// +// Created by Slava Karpenko on 2016/05/17. +// Copyright (c) 2016 Wildbit LLC. All rights reserved. +// + +#import +#import +#import + +#import "QuickSpec+GTFixtures.h" + +QuickSpecBegin(GTNoteSpec) + +__block GTRepository *repository; +__block GTCommit *initialCommit; + +beforeEach(^{ + NSURL *fileURL = [self.tempDirectoryFileURL URLByAppendingPathComponent:[[NSUUID alloc] init].UUIDString isDirectory:NO]; + repository = [GTRepository initializeEmptyRepositoryAtFileURL:fileURL options:nil error:NULL]; + expect(repository).notTo(beNil()); + + GTTreeBuilder *builder = [[GTTreeBuilder alloc] initWithTree:nil repository:repository error:NULL]; + expect(builder).notTo(beNil()); + + GTTreeEntry *entry = [builder addEntryWithData:[@"Xyzzy" dataUsingEncoding:NSUTF8StringEncoding] fileName:@"test.txt" fileMode:GTFileModeBlob error:NULL]; + expect(entry).notTo(beNil()); + + GTTree *tree = [builder writeTree:NULL]; + expect(tree).notTo(beNil()); + + initialCommit = [repository createCommitWithTree:tree message:@"Initial commit" parents:nil updatingReferenceNamed:@"refs/heads/master" error:NULL]; + expect(initialCommit).notTo(beNil()); +}); + +it(@"can create notes", ^{ + // Annotate the commit + GTSignature* sig = [repository userSignatureForNow]; + expect(sig).notTo(beNil()); + + NSError* err = nil; + + GTNote *note = [repository createNote:@"Note text" target:initialCommit ref:nil author:sig committer:sig overwriteIfExists:YES error:&err]; + expect(note).notTo(beNil()); + expect(err).to(beNil()); + + [repository enumerateNotesWithError:&err ref:nil usingBlock:^(GTNote *note, GTObject *object, BOOL *stop) { + expect(note).notTo(beNil()); + expect(object).notTo(beNil()); + + expect(note.note).to(equal(@"Note text")); + }]; + expect(err).to(beNil()); +}); + +it(@"can delete notes", ^{ + // Annotate the commit + GTSignature* sig = [repository userSignatureForNow]; + expect(sig).notTo(beNil()); + + NSError* err = nil; + + GTNote *note = [repository createNote:@"Note text" target:initialCommit ref:nil author:sig committer:sig overwriteIfExists:YES error:&err]; + expect(note).notTo(beNil()); + expect(err).to(beNil()); + + BOOL res = [repository removeNoteFromObject:initialCommit ref:nil author:sig committer:sig error:&err]; + expect(@(res)).to(beTrue()); + expect(err).to(beNil()); + + NSMutableArray* notes = [NSMutableArray arrayWithCapacity:0]; + + [repository enumerateNotesWithError:&err ref:nil usingBlock:^(GTNote *note, GTObject *object, BOOL *stop) { + [notes addObject:note]; + }]; + + expect(@(notes.count)).to(equal(@(0))); +}); + +afterEach(^{ + [self tearDown]; +}); + +QuickSpecEnd From fe139865ad669c0a499e4002a4086ed50582addc Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Thu, 19 May 2016 17:56:32 +0300 Subject: [PATCH 068/228] Added support for [GTRepository pushNotes:...] --- ObjectiveGit/GTRepository+RemoteOperations.h | 14 ++++++++++++ ObjectiveGit/GTRepository+RemoteOperations.m | 24 ++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/ObjectiveGit/GTRepository+RemoteOperations.h b/ObjectiveGit/GTRepository+RemoteOperations.h index 4e675d489..4cbcfc607 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.h +++ b/ObjectiveGit/GTRepository+RemoteOperations.h @@ -97,6 +97,20 @@ typedef NS_ENUM(NSInteger, GTFetchPruneOption) { /// will point to an error describing what happened). - (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options error:(NSError **)error progress:(nullable void (^)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop))progressBlock; +/// Push a given Git notes reference name to a remote. +/// +/// noteRef - Name of the notes reference. If NULL, will default to whatever the default is (e.g. "refs/notes/commits") +/// remote - The remote to push to. Must not be nil. +/// options - Options applied to the push operation. Can be NULL. +/// Recognized options are: +/// `GTRepositoryRemoteOptionsCredentialProvider` +/// error - The error if one occurred. Can be NULL. +/// progressBlock - An optional callback for monitoring progress. May be NULL. +/// +/// Returns YES if the push was successful, NO otherwise (and `error`, if provided, +/// will point to an error describing what happened). +- (BOOL)pushNotes:(nullable NSString *)noteRef toRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options error:(NSError **)error progress:(nullable void (^)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop))progressBlock; + /// Delete a remote branch /// /// branch - The branch to push. Must not be nil. diff --git a/ObjectiveGit/GTRepository+RemoteOperations.m b/ObjectiveGit/GTRepository+RemoteOperations.m index 84716d495..2903a861a 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.m +++ b/ObjectiveGit/GTRepository+RemoteOperations.m @@ -21,6 +21,8 @@ #import "git2/errors.h" #import "git2/remote.h" +#import "git2/notes.h" +#import "git2/buffer.h" NSString *const GTRepositoryRemoteOptionsCredentialProvider = @"GTRepositoryRemoteOptionsCredentialProvider"; NSString *const GTRepositoryRemoteOptionsFetchPrune = @"GTRepositoryRemoteOptionsFetchPrune"; @@ -198,6 +200,28 @@ - (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions return [self pushRefspecs:refspecs toRemote:remote withOptions:options error:error progress:progressBlock]; } +- (BOOL)pushNotes:(NSString *)noteRef toRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error:(NSError **)error progress:(GTRemotePushTransferProgressBlock)progressBlock { + NSParameterAssert(remote != nil); + + if (noteRef == nil) { + git_buf default_ref_name = { 0 }; + int gitErr = git_note_default_ref(&default_ref_name, self.git_repository); + if (gitErr != GIT_OK) { + git_buf_free(&default_ref_name); + + if (error != NULL) { + *error = [NSError git_errorFor:gitErr description:@"Unable to get default git notes reference name"]; + } + + return NO; + } + + noteRef = [NSString stringWithUTF8String:default_ref_name.ptr]; + } + + return [self pushRefspecs:@[[NSString stringWithFormat:@"%@:%@", noteRef, noteRef]] toRemote:remote withOptions:options error:error progress:progressBlock]; +} + #pragma mark - Deletion (Public) - (BOOL)deleteBranch:(GTBranch *)branch fromRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error:(NSError **)error { NSParameterAssert(branch != nil); From 6df9faf6a16f13d5b820a144878abb3146a2fb3d Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Fri, 20 May 2016 14:01:11 +0300 Subject: [PATCH 069/228] Fixes per @tiennou feedback Some stylistic and other fixes based on @tiennou feedback on the pull request. --- ObjectiveGit/GTNote.h | 28 ++++++++-- ObjectiveGit/GTNote.m | 31 ++++++++--- ObjectiveGit/GTRepository+RemoteOperations.m | 2 + ObjectiveGit/GTRepository.h | 54 ++++++++++---------- ObjectiveGit/GTRepository.m | 32 +++++++----- ObjectiveGitTests/GTNoteSpec.m | 10 ++-- 6 files changed, 100 insertions(+), 57 deletions(-) diff --git a/ObjectiveGit/GTNote.h b/ObjectiveGit/GTNote.h index ef0f1de4c..ceaed62f5 100644 --- a/ObjectiveGit/GTNote.h +++ b/ObjectiveGit/GTNote.h @@ -51,11 +51,31 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly, strong) GTObject *target; /// The underlying `git_note` object. -- (git_note * _Nullable)git_note __attribute__((objc_returns_inner_pointer)); +- (git_note *)git_note __attribute__((objc_returns_inner_pointer)); -/// These initializers may fail if there's no note attached to the provided oid. -- (nullable instancetype)initWithTargetOID:(GTOID*)oid repository:(GTRepository*)repository ref:(nullable NSString*)ref; -- (nullable instancetype)initWithTargetGitOID:(git_oid*)oid repository:(git_repository *)repository ref:(const char* _Nullable)ref; +/// Create a note with target OID in the given repository. +/// +/// oid - OID of the target to attach to +/// repository - Repository containing the target OID refers to +/// referenceName - Name for the notes reference in the repo, or nil for default ("refs/notes/commits") +/// error - Will be filled with a NSError object in case of error. +/// May be NULL. +/// +/// Returns initialized GTNote instance or nil on failure (error will be populated, if passed). +- (nullable instancetype)initWithTargetOID:(GTOID *)oid repository:(GTRepository *)repository referenceName:(nullable NSString *)referenceName error:(NSError **)error; + +/// Create a note with target libgit2 oid in the given repository. +/// +/// oid - git_oid of the target to attach to +/// repository - Repository containing the target OID refers to +/// referenceName - Name for the notes reference in the repo, or NULL for default ("refs/notes/commits") +/// error - Will be filled with a git error code in case of error. +/// May be NULL. +/// +/// Returns initialized GTNote instance or nil on failure (error will be populated, if passed). +- (nullable instancetype)initWithTargetGitOID:(git_oid *)oid repository:(git_repository *)repository referenceName:(const char * _Nullable)referenceName error:(int * _Nullable)error; + +- (instancetype)init NS_UNAVAILABLE; @end diff --git a/ObjectiveGit/GTNote.m b/ObjectiveGit/GTNote.m index 76d4ee9af..ab500039a 100644 --- a/ObjectiveGit/GTNote.m +++ b/ObjectiveGit/GTNote.m @@ -57,19 +57,36 @@ - (GTOID*)targetOID { return [GTOID oidWithGitOid:git_note_id(self.git_note)]; } -- (instancetype)initWithTargetOID:(GTOID*)oid repository:(GTRepository*)repository ref:(NSString*)ref { - return [self initWithTargetGitOID:(git_oid *)oid.git_oid repository:repository.git_repository ref:ref.UTF8String]; +- (instancetype)initWithTargetOID:(GTOID *)oid repository:(GTRepository *)repository referenceName:(NSString *)referenceName error:(NSError **)error { + int err = GIT_OK; + + id object = [self initWithTargetGitOID:(git_oid *)oid.git_oid repository:repository.git_repository referenceName:referenceName.UTF8String error:&err]; + + if (err != GIT_OK && error != NULL) { + *error = [NSError git_errorFor:err description:@"Failed to create a note."]; + } + + return object; } -- (instancetype)initWithTargetGitOID:(git_oid*)oid repository:(git_repository *)repository ref:(const char*)ref { - if (self = [super init]) { - int gitErr = git_note_read(&_note, repository, ref, oid); +- (instancetype)initWithTargetGitOID:(git_oid *)oid repository:(git_repository *)repository referenceName:(const char *)referenceName error:(int *)error { + self = [super init]; + if (self == nil) return nil; + + int gitErr = git_note_read(&_note, repository, referenceName, oid); + + if (gitErr != GIT_OK) { + if (error != NULL) *error = gitErr; - if (gitErr != GIT_OK) - return nil; // Cannot read the note, means it either doesn't exists for this object, this object is not found, or whatever else. + return nil; } return self; } +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + @end diff --git a/ObjectiveGit/GTRepository+RemoteOperations.m b/ObjectiveGit/GTRepository+RemoteOperations.m index 2903a861a..d36925c3d 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.m +++ b/ObjectiveGit/GTRepository+RemoteOperations.m @@ -217,6 +217,8 @@ - (BOOL)pushNotes:(NSString *)noteRef toRemote:(GTRemote *)remote withOptions:(N } noteRef = [NSString stringWithUTF8String:default_ref_name.ptr]; + + git_buf_free(&default_ref_name); } return [self pushRefspecs:@[[NSString stringWithFormat:@"%@:%@", noteRef, noteRef]] toRemote:remote withOptions:options error:error progress:progressBlock]; diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index e73e84c6c..7a4e43cef 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -607,45 +607,45 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// Creates a new note in this repo (using a default notes reference, e.g. "refs/notes/commits") /// -/// note - Note text. -/// theTarget - Object (usually a commit) to which this note attaches to. -/// This object must belong to this repository. -/// ref - Name for the notes reference in the repo, or nil for default ("refs/notes/commits") -/// author - Signature of the author for this note, and -/// of the note creation time -/// committer - Signature of the committer for this note. -/// overwrite - If set to YES, the note will be overwritten if it already exists. -/// error - Will be filled with a NSError object in case of error. -/// May be NULL. +/// note - Note text. +/// theTarget - Object (usually a commit) to which this note refers to. +/// This object must belong to this repository. +/// referenceName - Name for the notes reference in the repo, or nil for default ("refs/notes/commits") +/// author - Signature of the author for this note, and +/// of the note creation time +/// committer - Signature of the committer for this note. +/// overwrite - If set to YES, the note will be overwritten if it already exists. +/// error - Will be filled with a NSError object in case of error. +/// May be NULL. /// /// Returns the newly created note or nil on error. -- (nullable GTNote *)createNote:(NSString *)note target:(GTObject *)theTarget ref:(nullable NSString *)ref author:(GTSignature *)author committer:(GTSignature *)committer overwriteIfExists:(BOOL)overwrite error:(NSError **)error; +- (nullable GTNote *)createNote:(NSString *)note target:(GTObject *)theTarget referenceName:(nullable NSString *)referenceName author:(GTSignature *)author committer:(GTSignature *)committer overwriteIfExists:(BOOL)overwrite error:(NSError **)error; /// Removes a note attached to object in this repo (using a default notes reference, e.g. "refs/notes/commits") /// -/// parentObject - Object (usually a commit) to which the note to be removed is attached to. -/// This object must belong to this repository. -/// ref - Name for the notes reference in the repo, or nil for default ("refs/notes/commits") -/// author - Signature of the author for this note removal, and -/// of the note removal time -/// committer - Signature of the committer for this note removal. -/// error - Will be filled with a NSError object in case of error. -/// May be NULL. +/// parentObject - Object (usually a commit) to which the note to be removed is attached to. +/// This object must belong to this repository. +/// referenceName - Name for the notes reference in the repo, or nil for default ("refs/notes/commits") +/// author - Signature of the author for this note removal, and +/// of the note removal time +/// committer - Signature of the committer for this note removal. +/// error - Will be filled with a NSError object in case of error. +/// May be NULL. /// /// Returns the YES on success and NO on error. -- (BOOL)removeNoteFromObject:(GTObject *)parentObject ref:(nullable NSString *)ref author:(GTSignature *)author committer:(GTSignature *)committer error:(NSError **)error; +- (BOOL)removeNoteFromObject:(GTObject *)parentObject referenceName:(nullable NSString *)referenceName author:(GTSignature *)author committer:(GTSignature *)committer error:(NSError **)error; /// Enumerates through all stored notes in this repo (using a default notes reference, e.g. "refs/notes/commits") /// -/// error - Will be filled with a NSError object in case of error. -/// May be null. -/// ref - Name for the notes reference in the repo, or nil for default ("refs/notes/commits") -/// block - A block to be called on each encountered note object. The block accepts -/// a reference to `note`, an `object` that is annotated with the note. -/// If the block sets `stop` to YES, the iterator is finished. +/// referenceName - Name for the notes reference in the repo, or nil for default ("refs/notes/commits") +/// error - Will be filled with a NSError object in case of error. +/// May be NULL. +/// block - A block to be called on each encountered note object. The block accepts +/// a reference to `note`, an `object` that is annotated with the note. +/// If the block sets `stop` to YES, the iterator is finished. /// /// Returns YES on overall success or NO on error of any kind. -- (BOOL)enumerateNotesWithError:(NSError **)error ref:(nullable NSString *)ref usingBlock:(void (^)(GTNote *note, GTObject *object, BOOL *stop))block; +- (BOOL)enumerateNotesWithReferenceName:(nullable NSString *)referenceName error:(NSError **)error usingBlock:(void (^)(GTNote *note, GTObject *object, BOOL *stop))block; @end diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 749737845..0f44d0c1a 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -922,21 +922,21 @@ - (BOOL)cleanupStateWithError:(NSError * _Nullable __autoreleasing *)error { #pragma mark Notes -- (GTNote *)createNote:(NSString *)note target:(GTObject *)theTarget ref:(NSString *)ref author:(GTSignature *)author committer:(GTSignature *)committer overwriteIfExists:(BOOL)overwrite error:(NSError **)error { +- (GTNote *)createNote:(NSString *)note target:(GTObject *)theTarget referenceName:(NSString *)referenceName author:(GTSignature *)author committer:(GTSignature *)committer overwriteIfExists:(BOOL)overwrite error:(NSError **)error { git_oid oid; - int gitError = git_note_create(&oid, self.git_repository, ref.UTF8String, author.git_signature, committer.git_signature, theTarget.OID.git_oid, [note UTF8String], overwrite ? 1 : 0); + int gitError = git_note_create(&oid, self.git_repository, referenceName.UTF8String, author.git_signature, committer.git_signature, theTarget.OID.git_oid, [note UTF8String], overwrite ? 1 : 0); if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to create a note in repository"]; return nil; } - return [[GTNote alloc] initWithTargetOID:theTarget.OID repository:self ref:ref]; + return [[GTNote alloc] initWithTargetOID:theTarget.OID repository:self referenceName:referenceName error:error]; } -- (BOOL)removeNoteFromObject:(GTObject *)parentObject ref:(NSString *)ref author:(GTSignature *)author committer:(GTSignature *)committer error:(NSError **)error { - int gitError = git_note_remove(self.git_repository, ref.UTF8String, author.git_signature, committer.git_signature, parentObject.OID.git_oid); +- (BOOL)removeNoteFromObject:(GTObject *)parentObject referenceName:(NSString *)referenceName author:(GTSignature *)author committer:(GTSignature *)committer error:(NSError **)error { + int gitError = git_note_remove(self.git_repository, referenceName.UTF8String, author.git_signature, committer.git_signature, parentObject.OID.git_oid); if (gitError != GIT_OK) { if(error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to delete note from %@", parentObject]; return NO; @@ -945,11 +945,11 @@ - (BOOL)removeNoteFromObject:(GTObject *)parentObject ref:(NSString *)ref author return YES; } -- (BOOL)enumerateNotesWithError:(NSError **)error ref:(NSString *)ref usingBlock:(void (^)(GTNote *note, GTObject *object, BOOL *stop))block +- (BOOL)enumerateNotesWithReferenceName:(NSString *)referenceName error:(NSError **)error usingBlock:(void (^)(GTNote *note, GTObject *object, BOOL *stop))block { - git_note_iterator* iter = NULL; + git_note_iterator *iter = NULL; - int gitError = git_note_iterator_new(&iter, self.git_repository, ref.UTF8String); + int gitError = git_note_iterator_new(&iter, self.git_repository, referenceName.UTF8String); if (gitError != GIT_OK) { @@ -960,22 +960,21 @@ - (BOOL)enumerateNotesWithError:(NSError **)error ref:(NSString *)ref usingBlock git_oid note_id; git_oid object_id; BOOL success = YES; + int iterError = GIT_OK; - while (git_note_next(¬e_id, &object_id, iter) == GIT_OK) { + while ((iterError = git_note_next(¬e_id, &object_id, iter)) == GIT_OK) { NSError* lookupErr = nil; - GTNote* note = [[GTNote alloc] initWithTargetGitOID:&object_id repository:self.git_repository ref:ref.UTF8String]; + GTNote* note = [[GTNote alloc] initWithTargetGitOID:&object_id repository:self.git_repository referenceName:referenceName.UTF8String error:&gitError]; if (note == nil) { - if (error != NULL) - *error = [NSError git_errorFor:GIT_ENOTFOUND description:@"Cannot create note"]; + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Cannot find a note"]; success = NO; break; } GTObject* obj = [self lookUpObjectByGitOid:&object_id error:&lookupErr]; if (obj == nil && lookupErr != nil) { - if (error != NULL) - *error = lookupErr; + if (error != NULL) *error = lookupErr; success = NO; break; } @@ -989,6 +988,11 @@ - (BOOL)enumerateNotesWithError:(NSError **)error ref:(NSString *)ref usingBlock git_note_iterator_free(iter); + if (iterError != GIT_OK && iterError != GIT_ITEROVER) { + if (error != NULL) + *error = [NSError git_errorFor:iterError description:@"Iterator error"]; + } + return success; } diff --git a/ObjectiveGitTests/GTNoteSpec.m b/ObjectiveGitTests/GTNoteSpec.m index 5b051ba64..c096f35b0 100644 --- a/ObjectiveGitTests/GTNoteSpec.m +++ b/ObjectiveGitTests/GTNoteSpec.m @@ -42,11 +42,11 @@ NSError* err = nil; - GTNote *note = [repository createNote:@"Note text" target:initialCommit ref:nil author:sig committer:sig overwriteIfExists:YES error:&err]; + GTNote *note = [repository createNote:@"Note text" target:initialCommit referenceName:nil author:sig committer:sig overwriteIfExists:YES error:&err]; expect(note).notTo(beNil()); expect(err).to(beNil()); - [repository enumerateNotesWithError:&err ref:nil usingBlock:^(GTNote *note, GTObject *object, BOOL *stop) { + [repository enumerateNotesWithReferenceName:nil error:&err usingBlock:^(GTNote *note, GTObject *object, BOOL *stop) { expect(note).notTo(beNil()); expect(object).notTo(beNil()); @@ -62,17 +62,17 @@ NSError* err = nil; - GTNote *note = [repository createNote:@"Note text" target:initialCommit ref:nil author:sig committer:sig overwriteIfExists:YES error:&err]; + GTNote *note = [repository createNote:@"Note text" target:initialCommit referenceName:nil author:sig committer:sig overwriteIfExists:YES error:&err]; expect(note).notTo(beNil()); expect(err).to(beNil()); - BOOL res = [repository removeNoteFromObject:initialCommit ref:nil author:sig committer:sig error:&err]; + BOOL res = [repository removeNoteFromObject:initialCommit referenceName:nil author:sig committer:sig error:&err]; expect(@(res)).to(beTrue()); expect(err).to(beNil()); NSMutableArray* notes = [NSMutableArray arrayWithCapacity:0]; - [repository enumerateNotesWithError:&err ref:nil usingBlock:^(GTNote *note, GTObject *object, BOOL *stop) { + [repository enumerateNotesWithReferenceName:nil error:&err usingBlock:^(GTNote *note, GTObject *object, BOOL *stop) { [notes addObject:note]; }]; From 947058db087a905bff0b207de459ae6de91fe856 Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Mon, 23 May 2016 18:18:48 +0300 Subject: [PATCH 070/228] Push branches and notes in one operation Added -[GTRepository pushBranches:toRemote:withOptions:withNotesReferenceName:error:progress:] to push both a set of branches and stored Git notes at the same operation to save on network ops. --- ObjectiveGit/GTNote.h | 10 ++++++ ObjectiveGit/GTNote.m | 21 ++++++++++++ ObjectiveGit/GTRepository+RemoteOperations.h | 26 ++++++++++++-- ObjectiveGit/GTRepository+RemoteOperations.m | 36 +++++++++----------- 4 files changed, 71 insertions(+), 22 deletions(-) diff --git a/ObjectiveGit/GTNote.h b/ObjectiveGit/GTNote.h index ceaed62f5..c0660c574 100644 --- a/ObjectiveGit/GTNote.h +++ b/ObjectiveGit/GTNote.h @@ -77,6 +77,16 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init NS_UNAVAILABLE; + +/// Return a default reference name (that is used if you pass nil to any referenceName parameter) +/// +/// repository - Repository for which to get the default notes reference name. +/// error - Will be filled with a git error code in case of error. +/// May be NULL. +/// +/// Returns default reference name (usually "refs/notes/commits"). ++ (NSString*)defaultReferenceNameForRepository:(GTRepository *)repository error:(NSError **)error; + @end NS_ASSUME_NONNULL_END diff --git a/ObjectiveGit/GTNote.m b/ObjectiveGit/GTNote.m index ab500039a..8cba1ca18 100644 --- a/ObjectiveGit/GTNote.m +++ b/ObjectiveGit/GTNote.m @@ -89,4 +89,25 @@ - (instancetype)init { return nil; } ++ (NSString*)defaultReferenceNameForRepository:(GTRepository *)repository error:(NSError **)error { + NSString* noteRef = nil; + + git_buf default_ref_name = { 0 }; + int gitErr = git_note_default_ref(&default_ref_name, repository.git_repository); + if (gitErr != GIT_OK) { + git_buf_free(&default_ref_name); + + if (error != NULL) { + *error = [NSError git_errorFor:gitErr description:@"Unable to get default git notes reference name"]; + } + + return nil; + } + + noteRef = [NSString stringWithUTF8String:default_ref_name.ptr]; + + git_buf_free(&default_ref_name); + + return noteRef; +} @end diff --git a/ObjectiveGit/GTRepository+RemoteOperations.h b/ObjectiveGit/GTRepository+RemoteOperations.h index 4cbcfc607..bd5dd231d 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.h +++ b/ObjectiveGit/GTRepository+RemoteOperations.h @@ -97,19 +97,39 @@ typedef NS_ENUM(NSInteger, GTFetchPruneOption) { /// will point to an error describing what happened). - (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options error:(NSError **)error progress:(nullable void (^)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop))progressBlock; -/// Push a given Git notes reference name to a remote. +/// Push an array of branches to a remote, together with notes (in one push). +/// Normally, if you use Git notes functionality, to push the notes to remote, you would have to +/// do two operations: pushBranches followed by pushNotes. This is unrational, so we offer you a handy +/// shortcut that allows to push the branches together with the notes. /// -/// noteRef - Name of the notes reference. If NULL, will default to whatever the default is (e.g. "refs/notes/commits") +/// branches - An array of branches to push. Must not be nil. /// remote - The remote to push to. Must not be nil. /// options - Options applied to the push operation. Can be NULL. /// Recognized options are: /// `GTRepositoryRemoteOptionsCredentialProvider` +/// referenceName - Reference name for notes, if they should be pushed together with the branches. +/// Use +[GTNote defaultReferenceNameWithError:] to push the default note reference. +/// Passing NULL here will make notes NOT to be pushed. /// error - The error if one occurred. Can be NULL. /// progressBlock - An optional callback for monitoring progress. May be NULL. /// /// Returns YES if the push was successful, NO otherwise (and `error`, if provided, /// will point to an error describing what happened). -- (BOOL)pushNotes:(nullable NSString *)noteRef toRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options error:(NSError **)error progress:(nullable void (^)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop))progressBlock; +- (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options withNotesReferenceName:(nullable NSString*)notesReferenceName error:(NSError **)error progress:(nullable void (^)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop))progressBlock; + +/// Push a given Git notes reference name to a remote. +/// +/// noteReferenceName - Name of the notes reference. If NULL, will default to whatever the default is (e.g. "refs/notes/commits") +/// remote - The remote to push to. Must not be nil. +/// options - Options applied to the push operation. Can be NULL. +/// Recognized options are: +/// `GTRepositoryRemoteOptionsCredentialProvider` +/// error - The error if one occurred. Can be NULL. +/// progressBlock - An optional callback for monitoring progress. May be NULL. +/// +/// Returns YES if the push was successful, NO otherwise (and `error`, if provided, +/// will point to an error describing what happened). +- (BOOL)pushNotes:(nullable NSString *)noteReferenceName toRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options error:(NSError **)error progress:(nullable void (^)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop))progressBlock; /// Delete a remote branch /// diff --git a/ObjectiveGit/GTRepository+RemoteOperations.m b/ObjectiveGit/GTRepository+RemoteOperations.m index d36925c3d..847b6c2ac 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.m +++ b/ObjectiveGit/GTRepository+RemoteOperations.m @@ -18,6 +18,7 @@ #import "NSArray+StringArray.h" #import "NSError+Git.h" #import "GTRepository+References.h" +#import "GTNote.h" #import "git2/errors.h" #import "git2/remote.h" @@ -174,29 +175,38 @@ - (BOOL)pushBranch:(GTBranch *)branch toRemote:(GTRemote *)remote withOptions:(N } - (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error:(NSError **)error progress:(GTRemotePushTransferProgressBlock)progressBlock { + return [self pushBranches:branches toRemote:remote withOptions:options withNotesReferenceName:nil error:error progress:progressBlock]; +} + +- (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(NSDictionary *)options withNotesReferenceName:(NSString*)referenceName error:(NSError **)error progress:(GTRemotePushTransferProgressBlock)progressBlock { NSParameterAssert(branches != nil); NSParameterAssert(branches.count != 0); NSParameterAssert(remote != nil); - + NSMutableArray *refspecs = nil; // Build refspecs for the passed in branches refspecs = [NSMutableArray arrayWithCapacity:branches.count]; for (GTBranch *branch in branches) { // Default remote reference for when branch doesn't exist on remote - create with same short name NSString *remoteBranchReference = [NSString stringWithFormat:@"refs/heads/%@", branch.shortName]; - + BOOL success = NO; GTBranch *trackingBranch = [branch trackingBranchWithError:error success:&success]; - + if (success && trackingBranch != nil) { // Use remote branch short name from trackingBranch, which could be different // (e.g. refs/heads/master:refs/heads/my_master) remoteBranchReference = [NSString stringWithFormat:@"refs/heads/%@", trackingBranch.shortName]; } - + [refspecs addObject:[NSString stringWithFormat:@"refs/heads/%@:%@", branch.shortName, remoteBranchReference]]; } - + + // Also push the notes reference, if needed. + if (referenceName != nil) { + [refspecs addObject:[NSString stringWithFormat:@"%@:%@", referenceName, referenceName]]; + } + return [self pushRefspecs:refspecs toRemote:remote withOptions:options error:error progress:progressBlock]; } @@ -204,21 +214,9 @@ - (BOOL)pushNotes:(NSString *)noteRef toRemote:(GTRemote *)remote withOptions:(N NSParameterAssert(remote != nil); if (noteRef == nil) { - git_buf default_ref_name = { 0 }; - int gitErr = git_note_default_ref(&default_ref_name, self.git_repository); - if (gitErr != GIT_OK) { - git_buf_free(&default_ref_name); - - if (error != NULL) { - *error = [NSError git_errorFor:gitErr description:@"Unable to get default git notes reference name"]; - } - - return NO; - } - - noteRef = [NSString stringWithUTF8String:default_ref_name.ptr]; + noteRef = [GTNote defaultReferenceNameForRepository:self error:error]; - git_buf_free(&default_ref_name); + if (noteRef == nil) return NO; } return [self pushRefspecs:@[[NSString stringWithFormat:@"%@:%@", noteRef, noteRef]] toRemote:remote withOptions:options error:error progress:progressBlock]; From e99a62e1f15999d7051e4716148c59edba18b84c Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Thu, 26 May 2016 19:46:32 +0300 Subject: [PATCH 071/228] Check if notes reference exists before pushing it --- ObjectiveGit/GTRepository+RemoteOperations.m | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ObjectiveGit/GTRepository+RemoteOperations.m b/ObjectiveGit/GTRepository+RemoteOperations.m index 847b6c2ac..746b2d363 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.m +++ b/ObjectiveGit/GTRepository+RemoteOperations.m @@ -204,7 +204,11 @@ - (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions // Also push the notes reference, if needed. if (referenceName != nil) { - [refspecs addObject:[NSString stringWithFormat:@"%@:%@", referenceName, referenceName]]; + // but check whether the reference exists for the repo, otherwise, our push will fail + GTReference* notesRef = [self lookUpReferenceWithName:referenceName error:nil]; + + if (notesRef != nil) + [refspecs addObject:[NSString stringWithFormat:@"%@:%@", referenceName, referenceName]]; } return [self pushRefspecs:refspecs toRemote:remote withOptions:options error:error progress:progressBlock]; @@ -219,6 +223,11 @@ - (BOOL)pushNotes:(NSString *)noteRef toRemote:(GTRemote *)remote withOptions:(N if (noteRef == nil) return NO; } + GTReference* notesReference = [self lookUpReferenceWithName:noteRef error:error]; + + if (notesReference == nil) + return NO; // error will be pre-filled with the lookUpReferenceWithName call + return [self pushRefspecs:@[[NSString stringWithFormat:@"%@:%@", noteRef, noteRef]] toRemote:remote withOptions:options error:error progress:progressBlock]; } From cfa48e405ee39066cb9b92f6bd5d4debe0a9463c Mon Sep 17 00:00:00 2001 From: Alexander Hedges Date: Mon, 27 Jun 2016 22:47:27 +0200 Subject: [PATCH 072/228] make returned credential optional --- ObjectiveGit/GTCredential.h | 4 ++-- ObjectiveGit/GTCredential.m | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ObjectiveGit/GTCredential.h b/ObjectiveGit/GTCredential.h index 5ecf3c7d2..e9786da4d 100644 --- a/ObjectiveGit/GTCredential.h +++ b/ObjectiveGit/GTCredential.h @@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN /// /// credentialBlock - a block that will be called when credentials are requested. /// Must not be nil. -+ (instancetype)providerWithBlock:(GTCredential *(^)(GTCredentialType type, NSString *URL, NSString *userName))credentialBlock; ++ (instancetype)providerWithBlock:(GTCredential * _Nullable(^)(GTCredentialType type, NSString *URL, NSString *userName))credentialBlock; /// Default credential provider method. /// @@ -46,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN /// type - the credential types allowed by the operation. /// URL - the URL the operation is authenticating against. /// userName - the user name provided by the operation. Can be nil, and might be ignored. -- (GTCredential *)credentialForType:(GTCredentialType)type URL:(NSString *)URL userName:(nullable NSString *)userName; +- (GTCredential * _Nullable)credentialForType:(GTCredentialType)type URL:(NSString *)URL userName:(nullable NSString *)userName; @end /// The GTCredential class is used to provide authentication data. diff --git a/ObjectiveGit/GTCredential.m b/ObjectiveGit/GTCredential.m index 03c43e326..f0fe1e01e 100644 --- a/ObjectiveGit/GTCredential.m +++ b/ObjectiveGit/GTCredential.m @@ -12,7 +12,7 @@ #import "git2/errors.h" -typedef GTCredential *(^GTCredentialProviderBlock)(GTCredentialType allowedTypes, NSString *URL, NSString *userName); +typedef GTCredential * _Nullable (^GTCredentialProviderBlock)(GTCredentialType allowedTypes, NSString *URL, NSString *userName); @interface GTCredentialProvider () @property (nonatomic, readonly, copy) GTCredentialProviderBlock credBlock; @@ -30,7 +30,7 @@ + (instancetype)providerWithBlock:(GTCredentialProviderBlock)credentialBlock { return provider; } -- (GTCredential *)credentialForType:(GTCredentialType)type URL:(NSString *)URL userName:(NSString *)userName { +- (GTCredential * _Nullable)credentialForType:(GTCredentialType)type URL:(NSString *)URL userName:(NSString *)userName { NSAssert(self.credBlock != nil, @"Provider asked for credentials without block being set."); return self.credBlock(type, URL, userName); From 2a9ccda1dd4b82745273a86380e9900c07a4f706 Mon Sep 17 00:00:00 2001 From: Alexander Hedges Date: Tue, 28 Jun 2016 08:43:09 +0200 Subject: [PATCH 073/228] only use _Nullable in header file --- ObjectiveGit/GTCredential.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ObjectiveGit/GTCredential.m b/ObjectiveGit/GTCredential.m index f0fe1e01e..03c43e326 100644 --- a/ObjectiveGit/GTCredential.m +++ b/ObjectiveGit/GTCredential.m @@ -12,7 +12,7 @@ #import "git2/errors.h" -typedef GTCredential * _Nullable (^GTCredentialProviderBlock)(GTCredentialType allowedTypes, NSString *URL, NSString *userName); +typedef GTCredential *(^GTCredentialProviderBlock)(GTCredentialType allowedTypes, NSString *URL, NSString *userName); @interface GTCredentialProvider () @property (nonatomic, readonly, copy) GTCredentialProviderBlock credBlock; @@ -30,7 +30,7 @@ + (instancetype)providerWithBlock:(GTCredentialProviderBlock)credentialBlock { return provider; } -- (GTCredential * _Nullable)credentialForType:(GTCredentialType)type URL:(NSString *)URL userName:(NSString *)userName { +- (GTCredential *)credentialForType:(GTCredentialType)type URL:(NSString *)URL userName:(NSString *)userName { NSAssert(self.credBlock != nil, @"Provider asked for credentials without block being set."); return self.credBlock(type, URL, userName); From 5908186b53e52a5ce3596133270cd52d379a2a55 Mon Sep 17 00:00:00 2001 From: David Catmull Date: Sat, 9 Jul 2016 08:29:54 -0600 Subject: [PATCH 074/228] Add updatePushURLString:error: to GTRemote --- ObjectiveGit/GTRemote.h | 10 ++++++++++ ObjectiveGit/GTRemote.m | 15 +++++++++++++++ ObjectiveGitTests/GTRemoteSpec.m | 15 +++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/ObjectiveGit/GTRemote.h b/ObjectiveGit/GTRemote.h index 7b6b9f828..78cbfc386 100644 --- a/ObjectiveGit/GTRemote.h +++ b/ObjectiveGit/GTRemote.h @@ -119,6 +119,16 @@ typedef enum { /// if updating or saving the remote failed. - (BOOL)updateURLString:(NSString *)URLString error:(NSError **)error; +/// Updates the push URL string for this remote. +/// +/// URLString - The URLString to update to. May not be nil. +/// error - If not NULL, this will be set to any error that occurs when +/// updating the URLString or saving the remote. +/// +/// Returns YES if the push URLString was successfully updated, NO and an error +/// if updating or saving the remote failed. +- (BOOL)updatePushURLString:(NSString *)URLString error:(NSError **)error; + /// Adds a fetch refspec to this remote. /// /// fetchRefspec - The fetch refspec string to add. May not be nil. diff --git a/ObjectiveGit/GTRemote.m b/ObjectiveGit/GTRemote.m index 25ffd2b3f..2adee7442 100644 --- a/ObjectiveGit/GTRemote.m +++ b/ObjectiveGit/GTRemote.m @@ -204,6 +204,21 @@ - (BOOL)updateURLString:(NSString *)URLString error:(NSError **)error { return YES; } +- (BOOL)updatePushURLString:(NSString *)URLString error:(NSError **)error { + NSParameterAssert(URLString != nil); + + if ([self.pushURLString isEqualToString:URLString]) return YES; + + int gitError = git_remote_set_pushurl(self.repository.git_repository, self.name.UTF8String, URLString.UTF8String); + if (gitError != GIT_OK) { + if (error != NULL) { + *error = [NSError git_errorFor:gitError description:@"Failed to update remote push URL string."]; + } + return NO; + } + return YES; +} + - (BOOL)addFetchRefspec:(NSString *)fetchRefspec error:(NSError **)error { NSParameterAssert(fetchRefspec != nil); diff --git a/ObjectiveGitTests/GTRemoteSpec.m b/ObjectiveGitTests/GTRemoteSpec.m index 3656f8cdf..f2a2da164 100644 --- a/ObjectiveGitTests/GTRemoteSpec.m +++ b/ObjectiveGitTests/GTRemoteSpec.m @@ -61,6 +61,21 @@ expect(remote.URLString).to(equal(newURLString)); }); + it(@"push URL string", ^{ + expect(remote.pushURLString).to(equal(@"git@github.com:github/Test_App.git")); + + NSString *newURLString = @"https://github.com/github/Test_App.git"; + + __block NSError *error = nil; + expect(@([remote updatePushURLString:newURLString error:&error])).to(beTruthy()); + expect(error).to(beNil()); + + // Reload remote from disk to pick up the change + remote = configuration.remotes[0]; + + expect(remote.pushURLString).to(equal(newURLString)); + }); + it(@"fetch refspecs", ^{ expect(remote.fetchRefspecs).to(equal(@[ fetchRefspec ])); From abface51546f2e9f22f9d646ea91981d0453bf40 Mon Sep 17 00:00:00 2001 From: David Catmull Date: Mon, 11 Jul 2016 08:28:15 -0600 Subject: [PATCH 075/228] Fix test: Push URL starts off empty --- ObjectiveGitTests/GTRemoteSpec.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGitTests/GTRemoteSpec.m b/ObjectiveGitTests/GTRemoteSpec.m index f2a2da164..35a098edc 100644 --- a/ObjectiveGitTests/GTRemoteSpec.m +++ b/ObjectiveGitTests/GTRemoteSpec.m @@ -62,7 +62,7 @@ }); it(@"push URL string", ^{ - expect(remote.pushURLString).to(equal(@"git@github.com:github/Test_App.git")); + expect(remote.pushURLString).to(beNil()); NSString *newURLString = @"https://github.com/github/Test_App.git"; From ddd558b995e637e846d13c2d00f69f84300988d5 Mon Sep 17 00:00:00 2001 From: Doug Fales Date: Sun, 19 Jun 2016 15:44:35 -0600 Subject: [PATCH 076/228] Exposing line info from git_diff_hunk in GTDiffHunk. --- ObjectiveGit/GTDiffHunk.h | 12 ++++++++++++ ObjectiveGit/GTDiffHunk.m | 4 ++++ ObjectiveGitTests/GTDiffSpec.m | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/ObjectiveGit/GTDiffHunk.h b/ObjectiveGit/GTDiffHunk.h index bb9a16d6c..8c3653efe 100644 --- a/ObjectiveGit/GTDiffHunk.h +++ b/ObjectiveGit/GTDiffHunk.h @@ -22,6 +22,18 @@ NS_ASSUME_NONNULL_BEGIN /// The number of lines represented in the hunk. @property (nonatomic, readonly) NSUInteger lineCount; +/// The starting line number in the old file +@property (nonatomic, readonly) NSUInteger oldStart; + +/// The number of lines in the old file +@property (nonatomic, readonly) NSUInteger oldLines; + +/// The starting line number in the new file +@property (nonatomic, readonly) NSUInteger newStart; + +/// The number of lines in the new file +@property (nonatomic, readonly) NSUInteger newLines; + - (instancetype)init NS_UNAVAILABLE; /// Designated initialiser. diff --git a/ObjectiveGit/GTDiffHunk.m b/ObjectiveGit/GTDiffHunk.m index d5174dcbc..f6d74bd0d 100644 --- a/ObjectiveGit/GTDiffHunk.m +++ b/ObjectiveGit/GTDiffHunk.m @@ -40,6 +40,10 @@ - (instancetype)initWithPatch:(GTDiffPatch *)patch hunkIndex:(NSUInteger)hunkInd int result = git_patch_get_hunk(&_git_hunk, &gitLineCount, patch.git_patch, hunkIndex); if (result != GIT_OK) return nil; _lineCount = gitLineCount; + _oldStart = self.git_hunk->old_start; + _oldLines = self.git_hunk->old_lines; + _newStart = self.git_hunk->new_start; + _newLines = self.git_hunk->new_lines; _patch = patch; _hunkIndex = hunkIndex; diff --git a/ObjectiveGitTests/GTDiffSpec.m b/ObjectiveGitTests/GTDiffSpec.m index 676dda6bb..9d1afd938 100644 --- a/ObjectiveGitTests/GTDiffSpec.m +++ b/ObjectiveGitTests/GTDiffSpec.m @@ -112,6 +112,10 @@ [patch enumerateHunksUsingBlock:^(GTDiffHunk *hunk, BOOL *stop) { expect(hunk.header).to(equal(@"@@ -4,7 +4,7 @@")); expect(@(hunk.lineCount)).to(equal(@8)); + expect(@(hunk.oldStart)).to(equal(@4)); + expect(@(hunk.oldLines)).to(equal(@7)); + expect(@(hunk.newStart)).to(equal(@4)); + expect(@(hunk.newLines)).to(equal(@7)); NSArray *expectedLines = @[ @"//", @"// Created by Joe Ricioppo on 9/29/10.", From c9566e2caf7c243560fd5eb662145d8e16dbefe4 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Sat, 28 May 2016 14:16:42 +0200 Subject: [PATCH 077/228] DRY our DeltaTypes enumerations --- ObjectiveGit/GTDiff.h | 2 +- ObjectiveGit/GTDiff.m | 2 +- ObjectiveGit/GTDiffDelta.h | 45 +++++++++++---------- ObjectiveGit/GTDiffDelta.m | 5 ++- ObjectiveGit/GTRepository+Status.m | 10 ++--- ObjectiveGit/GTStatusDelta.h | 18 +-------- ObjectiveGit/GTStatusDelta.m | 2 +- ObjectiveGitTests/GTDiffSpec.m | 10 ++--- ObjectiveGitTests/GTIndexSpec.m | 16 ++++---- ObjectiveGitTests/GTRepository+StatusSpec.m | 22 +++++----- ObjectiveGitTests/GTRepositoryResetSpec.m | 2 +- 11 files changed, 62 insertions(+), 72 deletions(-) diff --git a/ObjectiveGit/GTDiff.h b/ObjectiveGit/GTDiff.h index 85499e4e3..f25eee875 100644 --- a/ObjectiveGit/GTDiff.h +++ b/ObjectiveGit/GTDiff.h @@ -308,7 +308,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { - (git_diff *)git_diff __attribute__((objc_returns_inner_pointer)); /// The number of deltas of the given type that are contained in the diff. -- (NSUInteger)numberOfDeltasWithType:(GTDiffDeltaType)deltaType; +- (NSUInteger)numberOfDeltasWithType:(GTDeltaType)deltaType; /// Enumerate the deltas in a diff. /// diff --git a/ObjectiveGit/GTDiff.m b/ObjectiveGit/GTDiff.m index d12607acc..c0945d3b4 100644 --- a/ObjectiveGit/GTDiff.m +++ b/ObjectiveGit/GTDiff.m @@ -234,7 +234,7 @@ - (NSUInteger)deltaCount { return git_diff_num_deltas(self.git_diff); } -- (NSUInteger)numberOfDeltasWithType:(GTDiffDeltaType)deltaType { +- (NSUInteger)numberOfDeltasWithType:(GTDeltaType)deltaType { return git_diff_num_deltas_of_type(self.git_diff, (git_delta_t)deltaType); } diff --git a/ObjectiveGit/GTDiffDelta.h b/ObjectiveGit/GTDiffDelta.h index 49d9d0a7d..8687e6a46 100644 --- a/ObjectiveGit/GTDiffDelta.h +++ b/ObjectiveGit/GTDiffDelta.h @@ -17,27 +17,30 @@ /// The type of change that this delta represents. /// -/// GTDiffFileDeltaUnmodified - No Change. -/// GTDiffFileDeltaAdded - The file was added to the index. -/// GTDiffFileDeltaDeleted - The file was removed from the working directory. -/// GTDiffFileDeltaModified - The file was modified. -/// GTDiffFileDeltaRenamed - The file has been renamed. -/// GTDiffFileDeltaCopied - The file was duplicated. -/// GTDiffFileDeltaIgnored - The file was ignored by git. -/// GTDiffFileDeltaUntracked - The file has been added to the working directory +/// GTDeltaTypeUnmodified - No Change. +/// GTDeltaTypeAdded - The file was added to the index. +/// GTDeltaTypeDeleted - The file was removed from the working directory. +/// GTDeltaTypeModified - The file was modified. +/// GTDeltaTypeRenamed - The file has been renamed. +/// GTDeltaTypeCopied - The file was duplicated. +/// GTDeltaTypeIgnored - The file was ignored by git. +/// GTDeltaTypeUntracked - The file has been added to the working directory /// and is therefore currently untracked. -/// GTDiffFileDeltaTypeChange - The file has changed from a blob to either a +/// GTDeltaTypeTypeChange - The file has changed from a blob to either a /// submodule, symlink or directory. Or vice versa. -typedef NS_ENUM(NSInteger, GTDiffDeltaType) { - GTDiffFileDeltaUnmodified = GIT_DELTA_UNMODIFIED, - GTDiffFileDeltaAdded = GIT_DELTA_ADDED, - GTDiffFileDeltaDeleted = GIT_DELTA_DELETED, - GTDiffFileDeltaModified = GIT_DELTA_MODIFIED, - GTDiffFileDeltaRenamed = GIT_DELTA_RENAMED, - GTDiffFileDeltaCopied = GIT_DELTA_COPIED, - GTDiffFileDeltaIgnored = GIT_DELTA_IGNORED, - GTDiffFileDeltaUntracked = GIT_DELTA_UNTRACKED, - GTDiffFileDeltaTypeChange = GIT_DELTA_TYPECHANGE, +/// GTDeltaTypeConflicted - The file is conflicted in the working directory. +typedef NS_ENUM(NSInteger, GTDeltaType) { + GTDeltaTypeUnmodified = GIT_DELTA_UNMODIFIED, + GTDeltaTypeAdded = GIT_DELTA_ADDED, + GTDeltaTypeDeleted = GIT_DELTA_DELETED, + GTDeltaTypeModified = GIT_DELTA_MODIFIED, + GTDeltaTypeRenamed = GIT_DELTA_RENAMED, + GTDeltaTypeCopied = GIT_DELTA_COPIED, + GTDeltaTypeIgnored = GIT_DELTA_IGNORED, + GTDeltaTypeUntracked = GIT_DELTA_UNTRACKED, + GTDeltaTypeTypeChange = GIT_DELTA_TYPECHANGE, + GTDeltaTypeUnreadable = GIT_DELTA_UNREADABLE, + GTDeltaTypeConflicted = GIT_DELTA_CONFLICTED, }; NS_ASSUME_NONNULL_BEGIN @@ -45,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN /// A class representing a single change within a diff. /// /// The change may not be simply a change of text within a given file, it could -/// be that the file was renamed, or added to the index. See `GTDiffDeltaType` +/// be that the file was renamed, or added to the index. See `GTDeltaType` /// for the types of change represented. @interface GTDiffDelta : NSObject @@ -68,7 +71,7 @@ NS_ASSUME_NONNULL_BEGIN /// The type of change that this delta represents. /// /// Think "status" as in `git status`. -@property (nonatomic, readonly) GTDiffDeltaType type; +@property (nonatomic, readonly) GTDeltaType type; /// Diffs the given blob and data buffer. /// diff --git a/ObjectiveGit/GTDiffDelta.m b/ObjectiveGit/GTDiffDelta.m index 952222dee..9fdd32aeb 100644 --- a/ObjectiveGit/GTDiffDelta.m +++ b/ObjectiveGit/GTDiffDelta.m @@ -56,8 +56,9 @@ - (GTDiffFile *)newFile { return [[GTDiffFile alloc] initWithGitDiffFile:self.git_diff_delta.new_file]; } -- (GTDiffDeltaType)type { - return (GTDiffDeltaType)self.git_diff_delta.status; +- (GTDeltaType)type { + return (GTDeltaType)self.git_diff_delta.status; +} } #pragma mark Lifecycle diff --git a/ObjectiveGit/GTRepository+Status.m b/ObjectiveGit/GTRepository+Status.m index f486668c0..7f2559134 100644 --- a/ObjectiveGit/GTRepository+Status.m +++ b/ObjectiveGit/GTRepository+Status.m @@ -68,23 +68,23 @@ - (BOOL)enumerateFileStatusWithOptions:(NSDictionary *)options error:(NSError ** - (BOOL)isWorkingDirectoryClean { __block BOOL clean = YES; [self enumerateFileStatusWithOptions:nil error:NULL usingBlock:^(GTStatusDelta *headToIndex, GTStatusDelta *indexToWorkingDirectory, BOOL *stop) { - GTStatusDeltaStatus headToIndexStatus = headToIndex.status; - GTStatusDeltaStatus indexToWorkDirStatus = indexToWorkingDirectory.status; + GTDeltaType headToIndexStatus = headToIndex.status; + GTDeltaType indexToWorkDirStatus = indexToWorkingDirectory.status; // first, have items been deleted? - if (indexToWorkDirStatus == GTStatusDeltaStatusDeleted || headToIndexStatus == GTStatusDeltaStatusDeleted) { + if (indexToWorkDirStatus == GTDeltaTypeDeleted || headToIndexStatus == GTDeltaTypeDeleted) { clean = NO; *stop = YES; } // any untracked files? - if (indexToWorkDirStatus == GTStatusDeltaStatusUntracked) { + if (indexToWorkDirStatus == GTDeltaTypeUntracked) { clean = NO; *stop = YES; } // next, have items been modified? - if (indexToWorkDirStatus == GTStatusDeltaStatusModified || headToIndexStatus == GTStatusDeltaStatusModified) { + if (indexToWorkDirStatus == GTDeltaTypeModified || headToIndexStatus == GTDeltaTypeModified) { clean = NO; *stop = YES; } diff --git a/ObjectiveGit/GTStatusDelta.h b/ObjectiveGit/GTStatusDelta.h index 24bea36ba..433be3f3e 100644 --- a/ObjectiveGit/GTStatusDelta.h +++ b/ObjectiveGit/GTStatusDelta.h @@ -8,24 +8,10 @@ #import #import "git2/diff.h" +#import @class GTDiffFile; -/// An enum representing the status of the file. -/// -/// See diff.h for documentation of individual flags. -typedef NS_ENUM(NSInteger, GTStatusDeltaStatus) { - GTStatusDeltaStatusUnmodified = GIT_DELTA_UNMODIFIED, - GTStatusDeltaStatusAdded = GIT_DELTA_ADDED, - GTStatusDeltaStatusDeleted = GIT_DELTA_DELETED, - GTStatusDeltaStatusModified = GIT_DELTA_MODIFIED, - GTStatusDeltaStatusRenamed = GIT_DELTA_RENAMED, - GTStatusDeltaStatusCopied = GIT_DELTA_COPIED, - GTStatusDeltaStatusIgnored = GIT_DELTA_IGNORED, - GTStatusDeltaStatusUntracked = GIT_DELTA_UNTRACKED, - GTStatusDeltaStatusTypeChange = GIT_DELTA_TYPECHANGE, -}; - NS_ASSUME_NONNULL_BEGIN /// Represents the status of a file in a repository. @@ -38,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly, copy, nullable) GTDiffFile *newFile __attribute__((ns_returns_not_retained)); /// The status of the file. -@property (nonatomic, readonly) GTStatusDeltaStatus status; +@property (nonatomic, readonly) GTDeltaType status; /// A float between 0 and 1 describing how similar the old and new /// files are (where 0 is not at all and 1 is identical). diff --git a/ObjectiveGit/GTStatusDelta.m b/ObjectiveGit/GTStatusDelta.m index 04b80b7fe..c1538675b 100644 --- a/ObjectiveGit/GTStatusDelta.m +++ b/ObjectiveGit/GTStatusDelta.m @@ -23,7 +23,7 @@ - (instancetype)initWithGitDiffDelta:(const git_diff_delta *)delta { _oldFile = [[GTDiffFile alloc] initWithGitDiffFile:delta->old_file]; _newFile = [[GTDiffFile alloc] initWithGitDiffFile:delta->new_file]; - _status = (GTStatusDeltaStatus)delta->status; + _status = (GTDeltaType)delta->status; _similarity = (double)(delta->similarity / 100.0); return self; diff --git a/ObjectiveGitTests/GTDiffSpec.m b/ObjectiveGitTests/GTDiffSpec.m index 9d1afd938..33718a24e 100644 --- a/ObjectiveGitTests/GTDiffSpec.m +++ b/ObjectiveGitTests/GTDiffSpec.m @@ -90,7 +90,7 @@ setupDiffFromCommitSHAsAndOptions(@"be0f001ff517a00b5b8e3c29ee6561e70f994e17", @"fe89ea0a8e70961b8a6344d9660c326d3f2eb0fe", nil); expect(@(diff.deltaCount)).to(equal(@1)); - expect(@([diff numberOfDeltasWithType:GTDiffFileDeltaModified])).to(equal(@1)); + expect(@([diff numberOfDeltasWithType:GTDeltaTypeModified])).to(equal(@1)); [diff enumerateDeltasUsingBlock:^(GTDiffDelta *delta, BOOL *stop) { NSError *error = nil; @@ -101,7 +101,7 @@ expect(delta.oldFile.path).to(equal(@"TestAppWindowController.h")); expect(delta.oldFile.path).to(equal(delta.newFile.path)); expect(@(delta.flags & GTDiffFileFlagBinaryMask)).to(equal(@(GTDiffFileFlagNotBinary))); - expect(@(delta.type)).to(equal(@(GTDiffFileDeltaModified))); + expect(@(delta.type)).to(equal(@(GTDeltaTypeModified))); expect(patch.delta).to(beIdenticalTo(delta)); expect(@(patch.hunkCount)).to(equal(@1)); @@ -155,7 +155,7 @@ expect(@(diff.deltaCount)).to(equal(@1)); [diff enumerateDeltasUsingBlock:^(GTDiffDelta *delta, BOOL *stop) { expect(delta.newFile.path).to(equal(@"REAME")); //loltypo - expect(@(delta.type)).to(equal(@(GTDiffFileDeltaAdded))); + expect(@(delta.type)).to(equal(@(GTDeltaTypeAdded))); *stop = YES; }]; @@ -166,7 +166,7 @@ expect(@(diff.deltaCount)).to(equal(@1)); [diff enumerateDeltasUsingBlock:^(GTDiffDelta *delta, BOOL *stop) { - expect(@(delta.type)).to(equal(@(GTDiffFileDeltaDeleted))); + expect(@(delta.type)).to(equal(@(GTDeltaTypeDeleted))); *stop = YES; }]; @@ -193,7 +193,7 @@ expect(@(diff.deltaCount)).to(equal(@1)); [diff enumerateDeltasUsingBlock:^(GTDiffDelta *delta, BOOL *stop) { - expect(@(delta.type)).to(equal(@(GTDiffFileDeltaRenamed))); + expect(@(delta.type)).to(equal(@(GTDeltaTypeRenamed))); expect(delta.oldFile.path).to(equal(@"README")); expect(delta.newFile.path).to(equal(@"README_renamed")); diff --git a/ObjectiveGitTests/GTIndexSpec.m b/ObjectiveGitTests/GTIndexSpec.m index c8a651053..48b258e8a 100644 --- a/ObjectiveGitTests/GTIndexSpec.m +++ b/ObjectiveGitTests/GTIndexSpec.m @@ -202,7 +202,7 @@ NSDictionary *renamedOptions = @{ GTRepositoryStatusOptionsFlagsKey: @(GTRepositoryStatusFlagsIncludeIgnored | GTRepositoryStatusFlagsIncludeUntracked | GTRepositoryStatusFlagsRecurseUntrackedDirectories | GTRepositoryStatusFlagsRenamesHeadToIndex | GTRepositoryStatusFlagsIncludeUnmodified) }; - BOOL (^fileStatusEqualsExpected)(NSString *filename, GTStatusDeltaStatus headToIndexStatus, GTStatusDeltaStatus indexToWorkingDirectoryStatus) = ^(NSString *filename, GTStatusDeltaStatus headToIndexStatus, GTStatusDeltaStatus indexToWorkingDirectoryStatus) { + BOOL (^fileStatusEqualsExpected)(NSString *filename, GTDeltaType headToIndexStatus, GTDeltaType indexToWorkingDirectoryStatus) = ^(NSString *filename, GTDeltaType headToIndexStatus, GTDeltaType indexToWorkingDirectoryStatus) { return [index.repository enumerateFileStatusWithOptions:renamedOptions error:NULL usingBlock:^(GTStatusDelta *headToIndex, GTStatusDelta *indexToWorkingDirectory, BOOL *stop) { if (![headToIndex.newFile.path isEqualToString:filename]) return; expect(@(headToIndex.status)).to(equal(@(headToIndexStatus))); @@ -230,32 +230,32 @@ it(@"it preserves decomposed Unicode in index paths with precomposeunicode disabled", ^{ NSString *decomposedFilename = [filename decomposedStringWithCanonicalMapping]; GTIndexEntry *entry = [index entryWithPath:decomposedFilename error:NULL]; - expect(@(fileStatusEqualsExpected(entry.path, GTStatusDeltaStatusUnmodified, GTStatusDeltaStatusUnmodified))).to(beTruthy()); + expect(@(fileStatusEqualsExpected(entry.path, GTDeltaTypeUnmodified, GTDeltaTypeUnmodified))).to(beTruthy()); expect(@([[NSFileManager defaultManager] moveItemAtURL:fileURL toURL:renamedFileURL error:NULL])).to(beTruthy()); entry = [index entryWithPath:decomposedFilename error:NULL]; - expect(@(fileStatusEqualsExpected(entry.path, GTStatusDeltaStatusUnmodified, GTStatusDeltaStatusDeleted))).to(beTruthy()); + expect(@(fileStatusEqualsExpected(entry.path, GTDeltaTypeUnmodified, GTDeltaTypeDeleted))).to(beTruthy()); [index removeFile:filename error:NULL]; [index addFile:renamedFilename error:NULL]; [index write:NULL]; entry = [index entryWithPath:[renamedFilename decomposedStringWithCanonicalMapping] error:NULL]; - expect(@(fileStatusEqualsExpected(entry.path, GTStatusDeltaStatusRenamed, GTStatusDeltaStatusUnmodified))).to(beTruthy()); + expect(@(fileStatusEqualsExpected(entry.path, GTDeltaTypeRenamed, GTDeltaTypeUnmodified))).to(beTruthy()); }); it(@"it preserves precomposed Unicode in index paths with precomposeunicode enabled", ^{ GTIndexEntry *fileEntry = [index entryWithPath:[filename decomposedStringWithCanonicalMapping] error:NULL]; expect(fileEntry).notTo(beNil()); - expect(@(fileStatusEqualsExpected(fileEntry.path, GTStatusDeltaStatusUnmodified, GTStatusDeltaStatusUnmodified))).to(beTruthy()); + expect(@(fileStatusEqualsExpected(fileEntry.path, GTDeltaTypeUnmodified, GTDeltaTypeUnmodified))).to(beTruthy()); [configuration setBool:true forKey:@"core.precomposeunicode"]; expect(@([configuration boolForKey:@"core.precomposeunicode"])).to(beTruthy()); GTIndexEntry *decomposedFileEntry = [index entryWithPath:[filename decomposedStringWithCanonicalMapping] error:NULL]; expect(decomposedFileEntry).notTo(beNil()); - expect(@(fileStatusEqualsExpected(decomposedFileEntry.path, GTStatusDeltaStatusUnmodified, GTStatusDeltaStatusDeleted))).to(beTruthy()); + expect(@(fileStatusEqualsExpected(decomposedFileEntry.path, GTDeltaTypeUnmodified, GTDeltaTypeDeleted))).to(beTruthy()); expect(@([[NSFileManager defaultManager] moveItemAtURL:fileURL toURL:renamedFileURL error:NULL])).to(beTruthy()); @@ -264,7 +264,7 @@ decomposedFileEntry = [index entryWithPath:[filename decomposedStringWithCanonicalMapping] error:NULL]; expect(decomposedFileEntry).notTo(beNil()); - expect(@(fileStatusEqualsExpected(decomposedFileEntry.path, GTStatusDeltaStatusUnmodified, GTStatusDeltaStatusDeleted))).to(beTruthy()); + expect(@(fileStatusEqualsExpected(decomposedFileEntry.path, GTDeltaTypeUnmodified, GTDeltaTypeDeleted))).to(beTruthy()); [index removeFile:filename error:NULL]; [index addFile:renamedFilename error:NULL]; @@ -272,7 +272,7 @@ GTIndexEntry *precomposedRenamedFileEntry = [index entryWithPath:renamedFilename error:NULL]; expect(precomposedRenamedFileEntry).notTo(beNil()); - expect(@(fileStatusEqualsExpected(precomposedFileEntry.path, GTStatusDeltaStatusRenamed, GTStatusDeltaStatusUntracked))).to(beTruthy()); + expect(@(fileStatusEqualsExpected(precomposedFileEntry.path, GTDeltaTypeRenamed, GTDeltaTypeUntracked))).to(beTruthy()); }); }); diff --git a/ObjectiveGitTests/GTRepository+StatusSpec.m b/ObjectiveGitTests/GTRepository+StatusSpec.m index 111f14a8d..0786728e0 100644 --- a/ObjectiveGitTests/GTRepository+StatusSpec.m +++ b/ObjectiveGitTests/GTRepository+StatusSpec.m @@ -27,7 +27,7 @@ expect(repository).notTo(beNil()); }); - void (^updateIndexForSubpathAndExpectStatus)(NSString *, GTStatusDeltaStatus) = ^(NSString *subpath, GTStatusDeltaStatus expectedIndexStatus) { + void (^updateIndexForSubpathAndExpectStatus)(NSString *, GTDeltaType) = ^(NSString *subpath, GTDeltaType expectedIndexStatus) { __block NSError *err = nil; GTIndex *index = [repository indexWithError:&err]; expect(err).to(beNil()); @@ -42,7 +42,7 @@ expect(err).to(beNil()); }; - void (^expectSubpathToHaveWorkDirStatus)(NSString *, GTStatusDeltaStatus) = ^(NSString *subpath, GTStatusDeltaStatus expectedWorkDirStatus) { + void (^expectSubpathToHaveWorkDirStatus)(NSString *, GTDeltaType) = ^(NSString *subpath, GTDeltaType expectedWorkDirStatus) { __block NSError *err = nil; NSDictionary *renamedOptions = @{ GTRepositoryStatusOptionsFlagsKey: @(GTRepositoryStatusFlagsIncludeIgnored | GTRepositoryStatusFlagsIncludeUntracked | GTRepositoryStatusFlagsRecurseUntrackedDirectories | GTRepositoryStatusFlagsRenamesIndexToWorkingDirectory) }; expect(@([repository enumerateFileStatusWithOptions:renamedOptions error:&err usingBlock:^(GTStatusDelta *headToIndex, GTStatusDelta *indexToWorkingDirectory, BOOL *stop) { @@ -52,55 +52,55 @@ expect(err).to(beNil()); }; - void (^expectSubpathToHaveMatchingStatus)(NSString *, GTStatusDeltaStatus) = ^(NSString *subpath, GTStatusDeltaStatus status) { + void (^expectSubpathToHaveMatchingStatus)(NSString *, GTDeltaType) = ^(NSString *subpath, GTDeltaType status) { expectSubpathToHaveWorkDirStatus(subpath, status); updateIndexForSubpathAndExpectStatus(subpath, status); }; it(@"should recognize untracked files", ^{ - expectSubpathToHaveWorkDirStatus(@"UntrackedImage.png", GTStatusDeltaStatusUntracked); + expectSubpathToHaveWorkDirStatus(@"UntrackedImage.png", GTDeltaTypeUntracked); }); it(@"should recognize added files", ^{ - updateIndexForSubpathAndExpectStatus(@"UntrackedImage.png", GTStatusDeltaStatusAdded); + updateIndexForSubpathAndExpectStatus(@"UntrackedImage.png", GTDeltaTypeAdded); }); it(@"should recognize modified files", ^{ expect(@([NSFileManager.defaultManager removeItemAtURL:targetFileURL error:&err])).to(beTruthy()); expect(err).to(beNil()); expect(@([testData writeToURL:targetFileURL atomically:YES])).to(beTruthy()); - expectSubpathToHaveMatchingStatus(targetFileURL.lastPathComponent, GTStatusDeltaStatusModified); + expectSubpathToHaveMatchingStatus(targetFileURL.lastPathComponent, GTDeltaTypeModified); }); it(@"should recognize copied files", ^{ NSURL *copyLocation = [repository.fileURL URLByAppendingPathComponent:@"main2.m"]; expect(@([NSFileManager.defaultManager copyItemAtURL:targetFileURL toURL:copyLocation error:&err])).to(beTruthy()); expect(err).to(beNil()); - updateIndexForSubpathAndExpectStatus(copyLocation.lastPathComponent, GTStatusDeltaStatusCopied); + updateIndexForSubpathAndExpectStatus(copyLocation.lastPathComponent, GTDeltaTypeCopied); }); it(@"should recognize deleted files", ^{ expect(@([NSFileManager.defaultManager removeItemAtURL:targetFileURL error:&err])).to(beTruthy()); expect(err).to(beNil()); - expectSubpathToHaveMatchingStatus(targetFileURL.lastPathComponent, GTStatusDeltaStatusDeleted); + expectSubpathToHaveMatchingStatus(targetFileURL.lastPathComponent, GTDeltaTypeDeleted); }); it(@"should recognize renamed files", ^{ NSURL *moveLocation = [repository.fileURL URLByAppendingPathComponent:@"main-moved.m"]; expect(@([NSFileManager.defaultManager moveItemAtURL:targetFileURL toURL:moveLocation error:&err])).to(beTruthy()); expect(err).to(beNil()); - expectSubpathToHaveWorkDirStatus(moveLocation.lastPathComponent, GTStatusDeltaStatusRenamed); + expectSubpathToHaveWorkDirStatus(moveLocation.lastPathComponent, GTDeltaTypeRenamed); }); it(@"should recognise ignored files", ^{ //at least in the default options - expectSubpathToHaveWorkDirStatus(@".DS_Store", GTStatusDeltaStatusIgnored); + expectSubpathToHaveWorkDirStatus(@".DS_Store", GTDeltaTypeIgnored); }); it(@"should skip ignored files if asked", ^{ __block NSError *err = nil; NSDictionary *options = @{ GTRepositoryStatusOptionsFlagsKey: @(0) }; BOOL enumerationSuccessful = [repository enumerateFileStatusWithOptions:options error:&err usingBlock:^(GTStatusDelta *headToIndex, GTStatusDelta *indexToWorkingDirectory, BOOL *stop) { - expect(@(indexToWorkingDirectory.status)).notTo(equal(@(GTStatusDeltaStatusIgnored))); + expect(@(indexToWorkingDirectory.status)).notTo(equal(@(GTDeltaTypeIgnored))); }]; expect(@(enumerationSuccessful)).to(beTruthy()); expect(err).to(beNil()); diff --git a/ObjectiveGitTests/GTRepositoryResetSpec.m b/ObjectiveGitTests/GTRepositoryResetSpec.m index 99bee463a..241f4807c 100644 --- a/ObjectiveGitTests/GTRepositoryResetSpec.m +++ b/ObjectiveGitTests/GTRepositoryResetSpec.m @@ -25,7 +25,7 @@ countStagedFiles = ^{ __block NSUInteger count = 0; [repository enumerateFileStatusWithOptions:nil error:NULL usingBlock:^(GTStatusDelta *headToIndex, GTStatusDelta *indexToWorkingDirectory, BOOL *stop) { - if (headToIndex.status != GTStatusDeltaStatusUnmodified) count++; + if (headToIndex.status != GTDeltaTypeUnmodified) count++; }]; return count; From f7a846e931eb5eef0be2b38c34c62f908cae959a Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Tue, 28 Jun 2016 08:20:18 +0000 Subject: [PATCH 078/228] Add similarity accessor to diff deltas --- ObjectiveGit/GTDiffDelta.h | 2 ++ ObjectiveGit/GTDiffDelta.m | 3 +++ 2 files changed, 5 insertions(+) diff --git a/ObjectiveGit/GTDiffDelta.h b/ObjectiveGit/GTDiffDelta.h index 8687e6a46..0c3c83eb4 100644 --- a/ObjectiveGit/GTDiffDelta.h +++ b/ObjectiveGit/GTDiffDelta.h @@ -73,6 +73,8 @@ NS_ASSUME_NONNULL_BEGIN /// Think "status" as in `git status`. @property (nonatomic, readonly) GTDeltaType type; +@property (nonatomic, readonly, assign) double similarity; + /// Diffs the given blob and data buffer. /// /// oldBlob - The blob which should comprise the left side of the diff. May be diff --git a/ObjectiveGit/GTDiffDelta.m b/ObjectiveGit/GTDiffDelta.m index 9fdd32aeb..28358f14f 100644 --- a/ObjectiveGit/GTDiffDelta.m +++ b/ObjectiveGit/GTDiffDelta.m @@ -59,6 +59,9 @@ - (GTDiffFile *)newFile { - (GTDeltaType)type { return (GTDeltaType)self.git_diff_delta.status; } + +- (double)similarity { + return (double)(self.git_diff_delta.similarity / 100.0); } #pragma mark Lifecycle From 05067f75c9c17f701af02399b172f58afa60c0d4 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 15 Jul 2016 14:38:28 +0200 Subject: [PATCH 079/228] Split the OID lookup from the object lookup in GTEnumerator --- ObjectiveGit/GTEnumerator.h | 10 ++++++++++ ObjectiveGit/GTEnumerator.m | 22 ++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/ObjectiveGit/GTEnumerator.h b/ObjectiveGit/GTEnumerator.h index d3d9d60c2..900d3e60a 100644 --- a/ObjectiveGit/GTEnumerator.h +++ b/ObjectiveGit/GTEnumerator.h @@ -117,6 +117,16 @@ NS_ASSUME_NONNULL_BEGIN /// Returns a (possibly empty) array of GTCommits, or nil if an error occurs. - (nullable NSArray *)allObjectsWithError:(NSError **)error; +/// Get the next OID. +/// +/// success - If not NULL, this will be set to whether getting the next object +/// was successful. This will be YES if the receiver is exhausted, so +/// it can be used to interpret the meaning of a nil return value. +/// error - If not NULL, set to any error that occurs during traversal. +/// +/// Returns nil if an error occurs or the enumeration is done. +- (nullable GTOID *)nextOIDWithSuccess:(nullable BOOL *)success error:(NSError **)error; + /// Gets the next commit. /// /// success - If not NULL, this will be set to whether getting the next object diff --git a/ObjectiveGit/GTEnumerator.m b/ObjectiveGit/GTEnumerator.m index 673d7f8c6..4b45a59f8 100644 --- a/ObjectiveGit/GTEnumerator.m +++ b/ObjectiveGit/GTEnumerator.m @@ -145,16 +145,34 @@ - (void)resetWithOptions:(GTEnumeratorOptions)options { #pragma mark Enumerating -- (GTCommit *)nextObjectWithSuccess:(BOOL *)success error:(NSError **)error { +- (GTOID *)nextOIDWithSuccess:(BOOL *)success error:(NSError **)error { git_oid oid; + int gitError = git_revwalk_next(&oid, self.walk); if (gitError == GIT_ITEROVER) { if (success != NULL) *success = YES; return nil; } + if (gitError != GIT_OK) { + if (success != NULL) *success = NO; + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Enumeration failed"]; + return nil; + } + + if (success != NULL) *success = YES; + return [GTOID oidWithGitOid:&oid]; +} + +- (GTCommit *)nextObjectWithSuccess:(BOOL *)success error:(NSError **)error { + GTOID *oid = [self nextOIDWithSuccess:success error:error]; + if (oid == nil) { + // We don't care whether the iteration completed, or an error occurred, + // there's nothing to lookup. + return nil; + } // Ignore error if we can't lookup object and just return nil. - GTCommit *commit = [self.repository lookUpObjectByGitOid:&oid objectType:GTObjectTypeCommit error:error]; + GTCommit *commit = [self.repository lookUpObjectByOID:oid objectType:GTObjectTypeCommit error:error]; if (success != NULL) *success = (commit != nil); return commit; } From 73037a4d5d07d3ccfd512637f4f04194e70636b3 Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Tue, 6 Sep 2016 23:48:05 +0300 Subject: [PATCH 080/228] Style fixes per @tiennou feedback --- ObjectiveGit/GTNote.h | 2 +- ObjectiveGit/GTNote.m | 16 +++++++---- ObjectiveGit/GTRepository+RemoteOperations.h | 2 +- ObjectiveGit/GTRepository+RemoteOperations.m | 30 ++++++++++---------- ObjectiveGit/GTRepository.h | 4 +-- 5 files changed, 30 insertions(+), 24 deletions(-) diff --git a/ObjectiveGit/GTNote.h b/ObjectiveGit/GTNote.h index c0660c574..1d9800e55 100644 --- a/ObjectiveGit/GTNote.h +++ b/ObjectiveGit/GTNote.h @@ -85,7 +85,7 @@ NS_ASSUME_NONNULL_BEGIN /// May be NULL. /// /// Returns default reference name (usually "refs/notes/commits"). -+ (NSString*)defaultReferenceNameForRepository:(GTRepository *)repository error:(NSError **)error; ++ (NSString *)defaultReferenceNameForRepository:(GTRepository *)repository error:(NSError **)error; @end diff --git a/ObjectiveGit/GTNote.m b/ObjectiveGit/GTNote.m index 8cba1ca18..b0ef6d365 100644 --- a/ObjectiveGit/GTNote.m +++ b/ObjectiveGit/GTNote.m @@ -41,7 +41,7 @@ - (git_note *)git_note { return _note; } -- (NSString*)note { +- (NSString *)note { return @(git_note_message(self.git_note)); } @@ -53,7 +53,7 @@ - (GTSignature *)committer { return [[GTSignature alloc] initWithGitSignature:git_note_committer(self.git_note)]; } -- (GTOID*)targetOID { +- (GTOID *)targetOID { return [GTOID oidWithGitOid:git_note_id(self.git_note)]; } @@ -89,8 +89,8 @@ - (instancetype)init { return nil; } -+ (NSString*)defaultReferenceNameForRepository:(GTRepository *)repository error:(NSError **)error { - NSString* noteRef = nil; ++ (NSString *)defaultReferenceNameForRepository:(GTRepository *)repository error:(NSError **)error { + NSString *noteRef = nil; git_buf default_ref_name = { 0 }; int gitErr = git_note_default_ref(&default_ref_name, repository.git_repository); @@ -104,7 +104,13 @@ + (NSString*)defaultReferenceNameForRepository:(GTRepository *)repository error: return nil; } - noteRef = [NSString stringWithUTF8String:default_ref_name.ptr]; + if (default_ref_name.ptr != NULL) { + noteRef = @(default_ref_name.ptr); + } else { + if (error != NULL) { + *error = [NSError git_errorFor:GIT_ERROR description:@"Unable to get default git notes reference name"]; + } + } git_buf_free(&default_ref_name); diff --git a/ObjectiveGit/GTRepository+RemoteOperations.h b/ObjectiveGit/GTRepository+RemoteOperations.h index bd5dd231d..32cb8cbe7 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.h +++ b/ObjectiveGit/GTRepository+RemoteOperations.h @@ -115,7 +115,7 @@ typedef NS_ENUM(NSInteger, GTFetchPruneOption) { /// /// Returns YES if the push was successful, NO otherwise (and `error`, if provided, /// will point to an error describing what happened). -- (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options withNotesReferenceName:(nullable NSString*)notesReferenceName error:(NSError **)error progress:(nullable void (^)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop))progressBlock; +- (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options withNotesReferenceName:(nullable NSString *)notesReferenceName error:(NSError **)error progress:(nullable void (^)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop))progressBlock; /// Push a given Git notes reference name to a remote. /// diff --git a/ObjectiveGit/GTRepository+RemoteOperations.m b/ObjectiveGit/GTRepository+RemoteOperations.m index 746b2d363..568ba32ca 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.m +++ b/ObjectiveGit/GTRepository+RemoteOperations.m @@ -178,37 +178,38 @@ - (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions return [self pushBranches:branches toRemote:remote withOptions:options withNotesReferenceName:nil error:error progress:progressBlock]; } -- (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(NSDictionary *)options withNotesReferenceName:(NSString*)referenceName error:(NSError **)error progress:(GTRemotePushTransferProgressBlock)progressBlock { +- (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(NSDictionary *)options withNotesReferenceName:(NSString *)referenceName error:(NSError **)error progress:(GTRemotePushTransferProgressBlock)progressBlock { NSParameterAssert(branches != nil); NSParameterAssert(branches.count != 0); NSParameterAssert(remote != nil); - + NSMutableArray *refspecs = nil; // Build refspecs for the passed in branches refspecs = [NSMutableArray arrayWithCapacity:branches.count]; for (GTBranch *branch in branches) { // Default remote reference for when branch doesn't exist on remote - create with same short name NSString *remoteBranchReference = [NSString stringWithFormat:@"refs/heads/%@", branch.shortName]; - + BOOL success = NO; GTBranch *trackingBranch = [branch trackingBranchWithError:error success:&success]; - + if (success && trackingBranch != nil) { // Use remote branch short name from trackingBranch, which could be different // (e.g. refs/heads/master:refs/heads/my_master) remoteBranchReference = [NSString stringWithFormat:@"refs/heads/%@", trackingBranch.shortName]; } - + [refspecs addObject:[NSString stringWithFormat:@"refs/heads/%@:%@", branch.shortName, remoteBranchReference]]; } // Also push the notes reference, if needed. if (referenceName != nil) { // but check whether the reference exists for the repo, otherwise, our push will fail - GTReference* notesRef = [self lookUpReferenceWithName:referenceName error:nil]; - - if (notesRef != nil) + GTReference *notesRef = [self lookUpReferenceWithName:referenceName error:nil]; + + if (notesRef != nil) { [refspecs addObject:[NSString stringWithFormat:@"%@:%@", referenceName, referenceName]]; + } } return [self pushRefspecs:refspecs toRemote:remote withOptions:options error:error progress:progressBlock]; @@ -216,18 +217,17 @@ - (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions - (BOOL)pushNotes:(NSString *)noteRef toRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error:(NSError **)error progress:(GTRemotePushTransferProgressBlock)progressBlock { NSParameterAssert(remote != nil); - + if (noteRef == nil) { noteRef = [GTNote defaultReferenceNameForRepository:self error:error]; if (noteRef == nil) return NO; } - - GTReference* notesReference = [self lookUpReferenceWithName:noteRef error:error]; - - if (notesReference == nil) - return NO; // error will be pre-filled with the lookUpReferenceWithName call - + + GTReference *notesReference = [self lookUpReferenceWithName:noteRef error:error]; + + if (notesReference == nil) return NO; + return [self pushRefspecs:@[[NSString stringWithFormat:@"%@:%@", noteRef, noteRef]] toRemote:remote withOptions:options error:error progress:progressBlock]; } diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index 7a4e43cef..1f84c3f48 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -621,7 +621,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// Returns the newly created note or nil on error. - (nullable GTNote *)createNote:(NSString *)note target:(GTObject *)theTarget referenceName:(nullable NSString *)referenceName author:(GTSignature *)author committer:(GTSignature *)committer overwriteIfExists:(BOOL)overwrite error:(NSError **)error; -/// Removes a note attached to object in this repo (using a default notes reference, e.g. "refs/notes/commits") +/// Removes a note attached to object in this repo /// /// parentObject - Object (usually a commit) to which the note to be removed is attached to. /// This object must belong to this repository. @@ -635,7 +635,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// Returns the YES on success and NO on error. - (BOOL)removeNoteFromObject:(GTObject *)parentObject referenceName:(nullable NSString *)referenceName author:(GTSignature *)author committer:(GTSignature *)committer error:(NSError **)error; -/// Enumerates through all stored notes in this repo (using a default notes reference, e.g. "refs/notes/commits") +/// Enumerates through all stored notes in this repo /// /// referenceName - Name for the notes reference in the repo, or nil for default ("refs/notes/commits") /// error - Will be filled with a NSError object in case of error. From fc9e9592c8258dcc6c2607ddbf9c1eb69724ecd8 Mon Sep 17 00:00:00 2001 From: David Catmull Date: Thu, 15 Sep 2016 15:50:12 -0600 Subject: [PATCH 081/228] Add some nullables to methods & properties that can return nil --- ObjectiveGit/GTCredential.h | 2 +- ObjectiveGit/GTIndex.h | 2 +- ObjectiveGit/GTOID.h | 2 +- ObjectiveGit/GTReference.h | 6 +++--- ObjectiveGit/GTRepository.h | 2 +- ObjectiveGit/GTSignature.h | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ObjectiveGit/GTCredential.h b/ObjectiveGit/GTCredential.h index e9786da4d..0bb210ab5 100644 --- a/ObjectiveGit/GTCredential.h +++ b/ObjectiveGit/GTCredential.h @@ -46,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN /// type - the credential types allowed by the operation. /// URL - the URL the operation is authenticating against. /// userName - the user name provided by the operation. Can be nil, and might be ignored. -- (GTCredential * _Nullable)credentialForType:(GTCredentialType)type URL:(NSString *)URL userName:(nullable NSString *)userName; +- (GTCredential * _Nullable)credentialForType:(GTCredentialType)type URL:(nullable NSString *)URL userName:(nullable NSString *)userName; @end /// The GTCredential class is used to provide authentication data. diff --git a/ObjectiveGit/GTIndex.h b/ObjectiveGit/GTIndex.h index c419c4e7c..8d4c7919b 100644 --- a/ObjectiveGit/GTIndex.h +++ b/ObjectiveGit/GTIndex.h @@ -69,7 +69,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs. /// /// Returns the loaded index, or nil if an error occurred. -+ (instancetype)indexWithFileURL:(NSURL *)fileURL repository:(GTRepository *)repository error:(NSError **)error; ++ (nullable instancetype)indexWithFileURL:(NSURL *)fileURL repository:(GTRepository *)repository error:(NSError **)error; - (instancetype)init NS_UNAVAILABLE; diff --git a/ObjectiveGit/GTOID.h b/ObjectiveGit/GTOID.h index 93ead4539..95bda1475 100644 --- a/ObjectiveGit/GTOID.h +++ b/ObjectiveGit/GTOID.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @interface GTOID : NSObject /// The SHA pointed to by the OID. -@property (nonatomic, readonly, copy) NSString *SHA; +@property (nonatomic, readonly, copy, nullable) NSString *SHA; /// Is the OID all zero? This usually indicates that the object has not been /// inserted into the ODB yet. diff --git a/ObjectiveGit/GTReference.h b/ObjectiveGit/GTReference.h index 5109e7d99..e9e0db1d4 100644 --- a/ObjectiveGit/GTReference.h +++ b/ObjectiveGit/GTReference.h @@ -52,7 +52,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly, strong) GTRepository *repository; @property (nonatomic, readonly) GTReferenceType referenceType; @property (nonatomic, readonly) const git_oid *git_oid; -@property (nonatomic, strong, readonly) GTOID *OID; +@property (nonatomic, strong, readonly, nullable) GTOID *OID; /// Whether this is a remote-tracking branch. @property (nonatomic, readonly, getter = isRemote) BOOL remote; @@ -78,10 +78,10 @@ NS_ASSUME_NONNULL_BEGIN - (git_reference *)git_reference __attribute__((objc_returns_inner_pointer)); /// The target (either GTObject or GTReference) to which the reference points. -@property (nonatomic, readonly, copy) id unresolvedTarget; +@property (nonatomic, readonly, copy, nullable) id unresolvedTarget; /// The resolved object to which the reference points. -@property (nonatomic, readonly, copy) id resolvedTarget; +@property (nonatomic, readonly, copy, nullable) id resolvedTarget; /// The last direct reference in a chain @property (nonatomic, readonly, copy) GTReference *resolvedReference; diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index 45f3caead..2dc71eaf9 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -167,7 +167,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { @interface GTRepository : NSObject /// The file URL for the repository's working directory. -@property (nonatomic, readonly, strong) NSURL *fileURL; +@property (nonatomic, readonly, strong, nullable) NSURL *fileURL; /// The file URL for the repository's .git directory. @property (nonatomic, readonly, strong, nullable) NSURL *gitDirectoryURL; diff --git a/ObjectiveGit/GTSignature.h b/ObjectiveGit/GTSignature.h index ab6b852ff..910af1a5c 100644 --- a/ObjectiveGit/GTSignature.h +++ b/ObjectiveGit/GTSignature.h @@ -42,10 +42,10 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly, copy, nullable) NSString *email; /// The time when the action happened. -@property (nonatomic, readonly, strong) NSDate *time; +@property (nonatomic, readonly, strong, nullable) NSDate *time; /// The time zone that `time` should be interpreted relative to. -@property (nonatomic, readonly, copy) NSTimeZone *timeZone; +@property (nonatomic, readonly, copy, nullable) NSTimeZone *timeZone; /// Initializes the receiver with the given signature. /// From bbea49dc84dc4d73756191603a5a7bbccf75d01b Mon Sep 17 00:00:00 2001 From: David Catmull Date: Fri, 16 Sep 2016 09:39:08 -0600 Subject: [PATCH 082/228] Use asserts because GTOID.SHA should never be nil. --- ObjectiveGit/GTOID.h | 2 +- ObjectiveGit/GTOID.m | 4 ++-- ObjectiveGit/GTRepository.h | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ObjectiveGit/GTOID.h b/ObjectiveGit/GTOID.h index 95bda1475..93ead4539 100644 --- a/ObjectiveGit/GTOID.h +++ b/ObjectiveGit/GTOID.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @interface GTOID : NSObject /// The SHA pointed to by the OID. -@property (nonatomic, readonly, copy, nullable) NSString *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. diff --git a/ObjectiveGit/GTOID.m b/ObjectiveGit/GTOID.m index 6cf387171..6483b5225 100644 --- a/ObjectiveGit/GTOID.m +++ b/ObjectiveGit/GTOID.m @@ -28,12 +28,12 @@ - (const git_oid *)git_oid { - (NSString *)SHA { char *SHA = malloc(GIT_OID_HEXSZ); - if (SHA == NULL) return nil; + NSAssert(SHA != NULL, @"Failed to malloc SHA string"); git_oid_fmt(SHA, self.git_oid); NSString *str = [[NSString alloc] initWithBytesNoCopy:SHA length:GIT_OID_HEXSZ encoding:NSUTF8StringEncoding freeWhenDone:YES]; - if (str == nil) free(SHA); + NSAssert(str != nil, @"Failed to allocate SHA string"); return str; } diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index 2dc71eaf9..40c17e1f3 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -167,6 +167,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { @interface GTRepository : NSObject /// The file URL for the repository's working directory. +/// Returns nil for a bare repository. @property (nonatomic, readonly, strong, nullable) NSURL *fileURL; /// The file URL for the repository's .git directory. @property (nonatomic, readonly, strong, nullable) NSURL *gitDirectoryURL; From b4ea30c3a70923b71cb492e72a31c120c5d51efc Mon Sep 17 00:00:00 2001 From: David Catmull Date: Fri, 16 Sep 2016 16:01:51 -0600 Subject: [PATCH 083/228] Use git_oid_tostr_s for GTOID.SHA --- ObjectiveGit/GTOID.m | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ObjectiveGit/GTOID.m b/ObjectiveGit/GTOID.m index 6483b5225..1cd3dd531 100644 --- a/ObjectiveGit/GTOID.m +++ b/ObjectiveGit/GTOID.m @@ -27,13 +27,11 @@ - (const git_oid *)git_oid { } - (NSString *)SHA { - char *SHA = malloc(GIT_OID_HEXSZ); - NSAssert(SHA != NULL, @"Failed to malloc SHA string"); - - git_oid_fmt(SHA, self.git_oid); - - NSString *str = [[NSString alloc] initWithBytesNoCopy:SHA length:GIT_OID_HEXSZ encoding:NSUTF8StringEncoding freeWhenDone:YES]; - NSAssert(str != nil, @"Failed to allocate SHA string"); + char *SHA = git_oid_tostr_s(self.git_oid); + NSString *str = [[NSString alloc] initWithBytes:SHA + length:GIT_OID_HEXSZ + encoding:NSUTF8StringEncoding]; + NSAssert(str != nil, @"Failed to create SHA string"); return str; } From 51f6656ffbd2049a1f088fb2af6809d74498945f Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 23 Sep 2016 00:55:32 +0200 Subject: [PATCH 084/228] Provide the OID whose lookup failed in the error --- ObjectiveGit/Categories/NSError+Git.h | 4 ++++ ObjectiveGit/Categories/NSError+Git.m | 1 + ObjectiveGit/GTRepository.m | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ObjectiveGit/Categories/NSError+Git.h b/ObjectiveGit/Categories/NSError+Git.h index bfe453dc0..4f7532f62 100644 --- a/ObjectiveGit/Categories/NSError+Git.h +++ b/ObjectiveGit/Categories/NSError+Git.h @@ -29,8 +29,12 @@ #import +/// The error domain used by Objective-Git extern NSString * const GTGitErrorDomain; +/// Error userinfo keys +extern NSString * const GTGitErrorOID; + @interface NSError (Git) /// Describes the given libgit2 error code, using any message provided by diff --git a/ObjectiveGit/Categories/NSError+Git.m b/ObjectiveGit/Categories/NSError+Git.m index cbc31509b..e66d2fcb3 100644 --- a/ObjectiveGit/Categories/NSError+Git.m +++ b/ObjectiveGit/Categories/NSError+Git.m @@ -31,6 +31,7 @@ #import "git2/errors.h" NSString * const GTGitErrorDomain = @"GTGitErrorDomain"; +NSString * const GTGitErrorOID = @"GTOID"; @implementation NSError (Git) diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index c2483ab57..96784c309 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -290,7 +290,10 @@ - (id)lookUpObjectByGitOid:(const git_oid *)oid objectType:(GTObjectType)type er if (error != NULL) { char oid_str[GIT_OID_HEXSZ+1]; git_oid_tostr(oid_str, sizeof(oid_str), oid); - *error = [NSError git_errorFor:gitError description:@"Failed to lookup object %s in repository.", oid_str]; + *error = [NSError git_errorFor:gitError + description:@"Failed to lookup object" + userInfo:@{GTGitErrorOID: [GTOID oidWithGitOid:oid]} + failureReason:@"The object %s couldn't be found in the repository.", oid_str]; } return nil; } From 4388caeefd2ffcec952002bbca5651a727e665c2 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 23 Sep 2016 01:36:20 +0200 Subject: [PATCH 085/228] carthage update ZipArchive is actually on its swift23 branch because Xcode 7 --- Cartfile.resolved | 6 +++--- Carthage/Checkouts/Nimble | 2 +- Carthage/Checkouts/Quick | 2 +- Carthage/Checkouts/ZipArchive | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cartfile.resolved b/Cartfile.resolved index b67d877a6..fb7614eff 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ -github "Quick/Nimble" "v4.0.0" -github "Quick/Quick" "v0.9.2" -github "ZipArchive/ZipArchive" "v1.1" +github "Quick/Nimble" "v4.1.0" +github "Quick/Quick" "v0.9.3" +github "ZipArchive/ZipArchive" "v1.6.1" github "jspahrsummers/xcconfigs" "0.9" diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble index 29f7fb373..b4a0f9d6e 160000 --- a/Carthage/Checkouts/Nimble +++ b/Carthage/Checkouts/Nimble @@ -1 +1 @@ -Subproject commit 29f7fb3732893f76fa851cb37b0c4b339c49cead +Subproject commit b4a0f9d6ee6b89f0e2f9ee8fa32aaa7200b1e27c diff --git a/Carthage/Checkouts/Quick b/Carthage/Checkouts/Quick index dc2b4b75d..faa6056c0 160000 --- a/Carthage/Checkouts/Quick +++ b/Carthage/Checkouts/Quick @@ -1 +1 @@ -Subproject commit dc2b4b75d2f718518acbdef289a72fad77975a8a +Subproject commit faa6056c0c7da69fc1fb494cf61fa264aea4d9bc diff --git a/Carthage/Checkouts/ZipArchive b/Carthage/Checkouts/ZipArchive index 057c49375..ddd27ec5a 160000 --- a/Carthage/Checkouts/ZipArchive +++ b/Carthage/Checkouts/ZipArchive @@ -1 +1 @@ -Subproject commit 057c4937552f421d782e6d07ae09191b191bcc23 +Subproject commit ddd27ec5abdedc04b2964bf45cf1e91f762da588 From 65755c82464ef4518568369f197a7c1a24a165c0 Mon Sep 17 00:00:00 2001 From: Robert Schilling Date: Tue, 11 Oct 2016 12:48:46 +0200 Subject: [PATCH 086/228] It's 2016 :tada: --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 5da811ff5..f9769cde8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License -Copyright (c) 2012 libgit2 contributors +Copyright (c) 2016 libgit2 contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 10420c9f7bee63d8e33b0810f2a765acce3cd32a Mon Sep 17 00:00:00 2001 From: David Catmull Date: Tue, 18 Oct 2016 08:35:49 -0600 Subject: [PATCH 087/228] Fix indentation --- ObjectiveGit/GTOID.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ObjectiveGit/GTOID.m b/ObjectiveGit/GTOID.m index 1cd3dd531..c9acc8fce 100644 --- a/ObjectiveGit/GTOID.m +++ b/ObjectiveGit/GTOID.m @@ -29,8 +29,8 @@ - (const git_oid *)git_oid { - (NSString *)SHA { char *SHA = git_oid_tostr_s(self.git_oid); NSString *str = [[NSString alloc] initWithBytes:SHA - length:GIT_OID_HEXSZ - encoding:NSUTF8StringEncoding]; + length:GIT_OID_HEXSZ + encoding:NSUTF8StringEncoding]; NSAssert(str != nil, @"Failed to create SHA string"); return str; } From f63763db194440d4bc4f352bfd3254af70268262 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Thu, 27 Oct 2016 10:15:24 +0200 Subject: [PATCH 088/228] Singleline-ify #FollowTheStyleGuide --- ObjectiveGit/GTRepository.m | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 96784c309..fc1e22d98 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -290,10 +290,7 @@ - (id)lookUpObjectByGitOid:(const git_oid *)oid objectType:(GTObjectType)type er if (error != NULL) { char oid_str[GIT_OID_HEXSZ+1]; git_oid_tostr(oid_str, sizeof(oid_str), oid); - *error = [NSError git_errorFor:gitError - description:@"Failed to lookup object" - userInfo:@{GTGitErrorOID: [GTOID oidWithGitOid:oid]} - failureReason:@"The object %s couldn't be found in the repository.", oid_str]; + *error = [NSError git_errorFor:gitError description:@"Failed to lookup object" userInfo:@{GTGitErrorOID: [GTOID oidWithGitOid:oid]} failureReason:@"The object %s couldn't be found in the repository.", oid_str]; } return nil; } From 2038841d354a1e6f17cb763ec87528dbff5ef24f Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Thu, 27 Oct 2016 11:15:05 +0200 Subject: [PATCH 089/228] Test if migrating to Xcode 8 works on Travis --- Cartfile.resolved | 2 +- Carthage/Checkouts/ZipArchive | 2 +- .../project.pbxproj | 33 ++++++++++++++++--- .../xcschemes/ObjectiveGit Mac.xcscheme | 2 +- .../xcschemes/ObjectiveGit iOS.xcscheme | 2 +- ObjectiveGitTests/GTBranchSpec.m | 1 + ObjectiveGitTests/Libgit2FeaturesSpec.m | 1 + 7 files changed, 34 insertions(+), 9 deletions(-) diff --git a/Cartfile.resolved b/Cartfile.resolved index fb7614eff..f2376fca0 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ github "Quick/Nimble" "v4.1.0" github "Quick/Quick" "v0.9.3" -github "ZipArchive/ZipArchive" "v1.6.1" +github "ZipArchive/ZipArchive" "v1.6.2" github "jspahrsummers/xcconfigs" "0.9" diff --git a/Carthage/Checkouts/ZipArchive b/Carthage/Checkouts/ZipArchive index ddd27ec5a..76ca4b329 160000 --- a/Carthage/Checkouts/ZipArchive +++ b/Carthage/Checkouts/ZipArchive @@ -1 +1 @@ -Subproject commit ddd27ec5abdedc04b2964bf45cf1e91f762da588 +Subproject commit 76ca4b3293e2effa548fdd6b09f8925a85d35a92 diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 731423e35..3426f3c5b 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -1256,11 +1256,18 @@ attributes = { LastSwiftUpdateCheck = 0700; LastTestingUpgradeCheck = 0510; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = "GitHub, Inc"; TargetAttributes = { + 88F05A6A16011E5400B7AD1D = { + LastSwiftMigration = 0800; + }; + 8DC2EF4F0486A6940098B216 = { + LastSwiftMigration = 0800; + }; D01B6ED219F82E2000D411BC = { CreatedOnToolsVersion = 6.1; + LastSwiftMigration = 0800; }; F879D8351B4B7F7C002D5C07 = { CreatedOnToolsVersion = 6.4; @@ -1694,6 +1701,9 @@ baseConfigurationReference = D0A463D817E57C45000F5021 /* Debug.xcconfig */; buildSettings = { CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; ENABLE_TESTABILITY = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO; @@ -1712,6 +1722,7 @@ "$(inherited)", "-DGIT_SSH", ); + SWIFT_VERSION = 2.3; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( "$(inherited)", @@ -1725,6 +1736,9 @@ baseConfigurationReference = D0A463DA17E57C45000F5021 /* Release.xcconfig */; buildSettings = { CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO; HEADER_SEARCH_PATHS = ( @@ -1741,6 +1755,7 @@ "$(inherited)", "-DGIT_SSH", ); + SWIFT_VERSION = 2.3; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( "$(inherited)", @@ -1845,6 +1860,9 @@ baseConfigurationReference = D0A463DB17E57C45000F5021 /* Test.xcconfig */; buildSettings = { CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO; HEADER_SEARCH_PATHS = ( @@ -1861,6 +1879,7 @@ "$(inherited)", "-DGIT_SSH", ); + SWIFT_VERSION = 2.3; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( "$(inherited)", @@ -1918,7 +1937,7 @@ baseConfigurationReference = D019778C19F830D100F523DA /* iOS-Framework.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; CURRENT_PROJECT_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -1982,7 +2001,7 @@ baseConfigurationReference = D019778C19F830D100F523DA /* iOS-Framework.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; CURRENT_PROJECT_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -2014,7 +2033,7 @@ baseConfigurationReference = D019778C19F830D100F523DA /* iOS-Framework.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; CURRENT_PROJECT_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -2046,7 +2065,7 @@ baseConfigurationReference = D019778C19F830D100F523DA /* iOS-Framework.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; CURRENT_PROJECT_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -2078,6 +2097,9 @@ baseConfigurationReference = D0A463D917E57C45000F5021 /* Profile.xcconfig */; buildSettings = { CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO; HEADER_SEARCH_PATHS = ( @@ -2094,6 +2116,7 @@ "$(inherited)", "-DGIT_SSH", ); + SWIFT_VERSION = 2.3; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( "$(inherited)", diff --git a/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme b/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme index 47f735a71..245964018 100644 --- a/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme +++ b/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme @@ -1,6 +1,6 @@ +#import #import #import diff --git a/ObjectiveGitTests/Libgit2FeaturesSpec.m b/ObjectiveGitTests/Libgit2FeaturesSpec.m index 0503b56b0..0868db2d7 100644 --- a/ObjectiveGitTests/Libgit2FeaturesSpec.m +++ b/ObjectiveGitTests/Libgit2FeaturesSpec.m @@ -7,6 +7,7 @@ // #import +#import #import #import From 6675b7fc82696d819a8afe0fe79b6059041e6abe Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Thu, 27 Oct 2016 13:27:29 +0200 Subject: [PATCH 090/228] Use Xcode8 --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9a6bf09bc..c9ad0c8c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,12 @@ -osx_image: xcode7 +osx_image: xcode8 language: objective-c matrix: fast_finish: true include: - - osx_image: xcode7.3 + - osx_image: xcode8 env: - SCHEME="ObjectiveGit Mac" - - osx_image: xcode7.3 + - osx_image: xcode8 env: - SCHEME="ObjectiveGit iOS" before_install: From edf3effa8f422bed1b98647f6684fb88925a2faf Mon Sep 17 00:00:00 2001 From: Guillaume Legrain Date: Sat, 8 Oct 2016 14:41:13 +0200 Subject: [PATCH 091/228] Added git_repository_open_ext wrapper --- ObjectiveGit/GTRepository.h | 34 ++++++++++++++++++++++++++++++++++ ObjectiveGit/GTRepository.m | 20 ++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index 45f3caead..78c88e254 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -110,6 +110,16 @@ extern NSString * const GTRepositoryCloneOptionsCloneLocal; /// A NSURL pointing to a local file that contains PEM-encoded certificate chain. extern NSString *const GTRepositoryCloneOptionsServerCertificateURL; +/// Repository extended open control flags for +/// +initWithURL:flags:ceilingDirs:error:. +/// +/// See respository.h for documentation of each individual flag. +typedef NS_OPTIONS(UInt32, GTRepositoryOpenFlags) { + GTRepositoryOpenNoSearch = GIT_REPOSITORY_OPEN_NO_SEARCH, + GTRepositoryOpenCrossFS = GIT_REPOSITORY_OPEN_CROSS_FS, + GTRepositoryOpenBare = GIT_REPOSITORY_OPEN_BARE, +}; + /// Initialization flags associated with `GTRepositoryInitOptionsFlags` for /// +initializeEmptyRepositoryAtFileURL:options:error:. /// @@ -201,6 +211,18 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// Returns the initialized repository, or nil if an error occurred. + (nullable instancetype)repositoryWithURL:(NSURL *)localFileURL error:(NSError **)error; +/// Convenience class initializer to find and open a repository with extended controls. +/// +/// localFileURL - The file URL for the new repository. Cannot be nil. +/// flags - A combination of the `GTRepositoryOpenFlags` flags. +/// ceilingDirs - A GIT_PATH_LIST_SEPARATOR delimited list of path prefixes at +/// which the search for a containing repository should terminate. +/// Can be NULL. +/// error - The error if one occurs. +/// +/// Returns the initialized repository, or nil if an error occurred. ++ (nullable instancetype)initWithURL:(NSURL *)localFileURL flags:(UInt32)flags ceilingDirs:(nullable const char *)ceilingDirs error:(NSError **)error; + /// Convenience initializer which uses the default options. /// /// localFileURL - The file URL for the new repository. Cannot be nil. @@ -209,6 +231,18 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// Returns the initialized repository, or nil if an error occurred. - (nullable instancetype)initWithURL:(NSURL *)localFileURL error:(NSError **)error; +/// Convenience initializer to find and open a repository with extended controls. +/// +/// localFileURL - The file URL for the new repository. Cannot be nil. +/// flags - A combination of the `GTRepositoryOpenFlags` flags. +/// ceilingDirs - A GIT_PATH_LIST_SEPARATOR delimited list of path prefixes at +/// which the search for a containing repository should terminate. +/// Can be NULL. +/// error - The error if one occurs. +/// +/// Returns the initialized repository, or nil if an error occurred. +- (nullable instancetype)initWithURL:(NSURL *)localFileURL flags:(UInt32)flags ceilingDirs:(nullable const char *)ceilingDirs error:(NSError **)error; + - (instancetype)init NS_UNAVAILABLE; /// Initializes the receiver to wrap the given repository object. Designated initializer. diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index fc1e22d98..8318c749b 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -145,6 +145,10 @@ + (instancetype)repositoryWithURL:(NSURL *)localFileURL error:(NSError **)error return [[self alloc] initWithURL:localFileURL error:error]; } ++ (instancetype)initWithURL:(NSURL *)localFileURL flags:(UInt32)flags ceilingDirs:(const char *)ceilingDirs error:(NSError **)error { + return [[self alloc] initWithURL:localFileURL flags:flags ceilingDirs:ceilingDirs error:error]; +} + - (instancetype)init { NSAssert(NO, @"Call to an unavailable initializer."); return nil; @@ -177,6 +181,22 @@ - (instancetype)initWithURL:(NSURL *)localFileURL error:(NSError **)error { return [self initWithGitRepository:r]; } +- (instancetype)initWithURL:(NSURL *)localFileURL flags:(UInt32)flags ceilingDirs:(const char *)ceilingDirs error:(NSError **)error { + if (!localFileURL.isFileURL || localFileURL.path == nil) { + if (error != NULL) *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnsupportedSchemeError userInfo:@{ NSLocalizedDescriptionKey: NSLocalizedString(@"Invalid file path URL to initialize repository.", @"") }]; + return nil; + } + + git_repository *r; + int gitError = git_repository_open_ext(&r, localFileURL.path.fileSystemRepresentation, flags, ceilingDirs); + if (gitError < GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to open repository at URL %@.", localFileURL]; + return nil; + } + + return [self initWithGitRepository:r]; +} + typedef void(^GTTransferProgressBlock)(const git_transfer_progress *progress, BOOL *stop); From d0bcc78dff1025a635f8f8d8c377f6272e9442f2 Mon Sep 17 00:00:00 2001 From: Guillaume Legrain Date: Mon, 10 Oct 2016 03:45:02 +0200 Subject: [PATCH 092/228] Removed convenient class initializer --- ObjectiveGit/GTRepository.h | 12 ------------ ObjectiveGit/GTRepository.m | 4 ---- 2 files changed, 16 deletions(-) diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index 78c88e254..6090f95df 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -211,18 +211,6 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// Returns the initialized repository, or nil if an error occurred. + (nullable instancetype)repositoryWithURL:(NSURL *)localFileURL error:(NSError **)error; -/// Convenience class initializer to find and open a repository with extended controls. -/// -/// localFileURL - The file URL for the new repository. Cannot be nil. -/// flags - A combination of the `GTRepositoryOpenFlags` flags. -/// ceilingDirs - A GIT_PATH_LIST_SEPARATOR delimited list of path prefixes at -/// which the search for a containing repository should terminate. -/// Can be NULL. -/// error - The error if one occurs. -/// -/// Returns the initialized repository, or nil if an error occurred. -+ (nullable instancetype)initWithURL:(NSURL *)localFileURL flags:(UInt32)flags ceilingDirs:(nullable const char *)ceilingDirs error:(NSError **)error; - /// Convenience initializer which uses the default options. /// /// localFileURL - The file URL for the new repository. Cannot be nil. diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 8318c749b..c98826683 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -145,10 +145,6 @@ + (instancetype)repositoryWithURL:(NSURL *)localFileURL error:(NSError **)error return [[self alloc] initWithURL:localFileURL error:error]; } -+ (instancetype)initWithURL:(NSURL *)localFileURL flags:(UInt32)flags ceilingDirs:(const char *)ceilingDirs error:(NSError **)error { - return [[self alloc] initWithURL:localFileURL flags:flags ceilingDirs:ceilingDirs error:error]; -} - - (instancetype)init { NSAssert(NO, @"Call to an unavailable initializer."); return nil; From 367ad428e014a67697d2b79fdd5440ceb7cf0c5d Mon Sep 17 00:00:00 2001 From: Guillaume Legrain Date: Mon, 10 Oct 2016 03:46:36 +0200 Subject: [PATCH 093/228] Changed parameters types --- ObjectiveGit/GTRepository.h | 15 +++++++-------- ObjectiveGit/GTRepository.m | 19 ++++++++++++++++--- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index 6090f95df..b98137207 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -114,7 +114,7 @@ extern NSString *const GTRepositoryCloneOptionsServerCertificateURL; /// +initWithURL:flags:ceilingDirs:error:. /// /// See respository.h for documentation of each individual flag. -typedef NS_OPTIONS(UInt32, GTRepositoryOpenFlags) { +typedef NS_OPTIONS(NSInteger, GTRepositoryOpenFlags) { GTRepositoryOpenNoSearch = GIT_REPOSITORY_OPEN_NO_SEARCH, GTRepositoryOpenCrossFS = GIT_REPOSITORY_OPEN_CROSS_FS, GTRepositoryOpenBare = GIT_REPOSITORY_OPEN_BARE, @@ -221,15 +221,14 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// Convenience initializer to find and open a repository with extended controls. /// -/// localFileURL - The file URL for the new repository. Cannot be nil. -/// flags - A combination of the `GTRepositoryOpenFlags` flags. -/// ceilingDirs - A GIT_PATH_LIST_SEPARATOR delimited list of path prefixes at -/// which the search for a containing repository should terminate. -/// Can be NULL. -/// error - The error if one occurs. +/// localFileURL - The file URL for the new repository. Cannot be nil. +/// flags - A combination of the `GTRepositoryOpenFlags` flags. +/// ceilingDirURLs - An array of URLs at which the search for a containing +/// repository should terminate. Can be NULL. +/// error - The error if one occurs. /// /// Returns the initialized repository, or nil if an error occurred. -- (nullable instancetype)initWithURL:(NSURL *)localFileURL flags:(UInt32)flags ceilingDirs:(nullable const char *)ceilingDirs error:(NSError **)error; +- (nullable instancetype)initWithURL:(NSURL *)localFileURL flags:(NSInteger)flags ceilingDirs:(nullable NSArray *)ceilingDirURLs error:(NSError **)error; - (instancetype)init NS_UNAVAILABLE; diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index c98826683..3a4976bc3 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -177,14 +177,27 @@ - (instancetype)initWithURL:(NSURL *)localFileURL error:(NSError **)error { return [self initWithGitRepository:r]; } -- (instancetype)initWithURL:(NSURL *)localFileURL flags:(UInt32)flags ceilingDirs:(const char *)ceilingDirs error:(NSError **)error { +- (instancetype)initWithURL:(NSURL *)localFileURL flags:(NSInteger)flags ceilingDirs:(NSArray *)ceilingDirURLs error:(NSError **)error { if (!localFileURL.isFileURL || localFileURL.path == nil) { - if (error != NULL) *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnsupportedSchemeError userInfo:@{ NSLocalizedDescriptionKey: NSLocalizedString(@"Invalid file path URL to initialize repository.", @"") }]; + if (error != NULL) *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnsupportedSchemeError userInfo:@{ NSLocalizedDescriptionKey: NSLocalizedString(@"Invalid file path URL to open.", @"") }]; return nil; } + // Concatenate URL paths. + NSMutableString *ceilingDirsString; + if (ceilingDirURLs.count > 0) { + ceilingDirsString = [[NSMutableString alloc] init]; + [ceilingDirURLs enumerateObjectsUsingBlock:^(NSURL * _Nonnull url, NSUInteger idx, BOOL * _Nonnull stop) { + if (idx < ceilingDirURLs.count - 1) { + [ceilingDirsString appendString:[NSString stringWithFormat:@"%@%c", url.path, GIT_PATH_LIST_SEPARATOR]]; + } else { + [ceilingDirsString appendString:url.path]; + } + }]; + } + git_repository *r; - int gitError = git_repository_open_ext(&r, localFileURL.path.fileSystemRepresentation, flags, ceilingDirs); + int gitError = git_repository_open_ext(&r, localFileURL.path.fileSystemRepresentation, (unsigned int)flags, ceilingDirsString.fileSystemRepresentation); if (gitError < GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to open repository at URL %@.", localFileURL]; return nil; From d3b4c34cfa657c382e232ae183d077a7ce4653be Mon Sep 17 00:00:00 2001 From: David Catmull Date: Tue, 1 Nov 2016 09:12:41 -0600 Subject: [PATCH 094/228] Make [GTRefLog initWithReference:] public --- ObjectiveGit/GTReflog+Private.h | 9 --------- ObjectiveGit/GTReflog.h | 8 ++++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ObjectiveGit/GTReflog+Private.h b/ObjectiveGit/GTReflog+Private.h index 19fc16b9f..cf21c00fe 100644 --- a/ObjectiveGit/GTReflog+Private.h +++ b/ObjectiveGit/GTReflog+Private.h @@ -8,17 +8,8 @@ #import "GTReflog.h" -@class GTReference; - @interface GTReflog () - (nullable instancetype)init NS_UNAVAILABLE; -/// Initializes the receiver with a reference. Designated initializer. -/// -/// reference - The reference whose reflog is being represented. Cannot be nil. -/// -/// Returns the initialized object. -- (nullable instancetype)initWithReference:(nonnull GTReference *)reference NS_DESIGNATED_INITIALIZER; - @end diff --git a/ObjectiveGit/GTReflog.h b/ObjectiveGit/GTReflog.h index cc03a60b9..581300f53 100644 --- a/ObjectiveGit/GTReflog.h +++ b/ObjectiveGit/GTReflog.h @@ -9,6 +9,7 @@ #import @class GTSignature; +@class GTReference; @class GTReflogEntry; NS_ASSUME_NONNULL_BEGIN @@ -20,6 +21,13 @@ NS_ASSUME_NONNULL_BEGIN /// The number of reflog entries. @property (nonatomic, readonly, assign) NSUInteger entryCount; +/// Initializes the receiver with a reference. Designated initializer. +/// +/// reference - The reference whose reflog is being represented. Cannot be nil. +/// +/// Returns the initialized object. +- (nullable instancetype)initWithReference:(nonnull GTReference *)reference NS_DESIGNATED_INITIALIZER; + /// Writes a new entry to the reflog. /// /// committer - The committer for the reflog entry. Cannot be nil. From 23525437c980e5a95842a6bee76a402f9edc8b46 Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Wed, 23 Nov 2016 19:41:04 +0300 Subject: [PATCH 095/228] Respect nullable returns in various methods Some properties could return nil where they are not annotated as such. --- ObjectiveGit/GTCredential.m | 2 +- ObjectiveGit/GTIndex.h | 2 +- ObjectiveGit/GTIndexEntry.h | 2 +- ObjectiveGit/GTOID.h | 2 +- ObjectiveGit/GTReference.h | 6 +++--- ObjectiveGit/GTRepository.h | 2 +- ObjectiveGit/GTSignature.h | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ObjectiveGit/GTCredential.m b/ObjectiveGit/GTCredential.m index 03c43e326..beb2d8da0 100644 --- a/ObjectiveGit/GTCredential.m +++ b/ObjectiveGit/GTCredential.m @@ -109,7 +109,7 @@ int GTCredentialAcquireCallback(git_cred **git_cred, const char *url, const char return GIT_ERROR; } - NSString *URL = (url != NULL ? @(url) : nil); + NSString *URL = (url != NULL ? @(url) : @""); NSString *userName = (username_from_url != NULL ? @(username_from_url) : nil); GTCredential *cred = [provider credentialForType:(GTCredentialType)allowed_types URL:URL userName:userName]; diff --git a/ObjectiveGit/GTIndex.h b/ObjectiveGit/GTIndex.h index c419c4e7c..8d4c7919b 100644 --- a/ObjectiveGit/GTIndex.h +++ b/ObjectiveGit/GTIndex.h @@ -69,7 +69,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs. /// /// Returns the loaded index, or nil if an error occurred. -+ (instancetype)indexWithFileURL:(NSURL *)fileURL repository:(GTRepository *)repository error:(NSError **)error; ++ (nullable instancetype)indexWithFileURL:(NSURL *)fileURL repository:(GTRepository *)repository error:(NSError **)error; - (instancetype)init NS_UNAVAILABLE; diff --git a/ObjectiveGit/GTIndexEntry.h b/ObjectiveGit/GTIndexEntry.h index 194b7d487..de9abf1ec 100644 --- a/ObjectiveGit/GTIndexEntry.h +++ b/ObjectiveGit/GTIndexEntry.h @@ -61,7 +61,7 @@ NS_ASSUME_NONNULL_BEGIN - (const git_index_entry *)git_index_entry __attribute__((objc_returns_inner_pointer)); /// The entry's index. This may be nil if nil is passed in to -initWithGitIndexEntry: -@property (nonatomic, strong, readonly) GTIndex *index; +@property (nonatomic, strong, readonly, nullable) GTIndex *index; /// The repository-relative path for the entry. @property (nonatomic, readonly, copy) NSString *path; diff --git a/ObjectiveGit/GTOID.h b/ObjectiveGit/GTOID.h index 93ead4539..95bda1475 100644 --- a/ObjectiveGit/GTOID.h +++ b/ObjectiveGit/GTOID.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @interface GTOID : NSObject /// The SHA pointed to by the OID. -@property (nonatomic, readonly, copy) NSString *SHA; +@property (nonatomic, readonly, copy, nullable) NSString *SHA; /// Is the OID all zero? This usually indicates that the object has not been /// inserted into the ODB yet. diff --git a/ObjectiveGit/GTReference.h b/ObjectiveGit/GTReference.h index 5109e7d99..e9e0db1d4 100644 --- a/ObjectiveGit/GTReference.h +++ b/ObjectiveGit/GTReference.h @@ -52,7 +52,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly, strong) GTRepository *repository; @property (nonatomic, readonly) GTReferenceType referenceType; @property (nonatomic, readonly) const git_oid *git_oid; -@property (nonatomic, strong, readonly) GTOID *OID; +@property (nonatomic, strong, readonly, nullable) GTOID *OID; /// Whether this is a remote-tracking branch. @property (nonatomic, readonly, getter = isRemote) BOOL remote; @@ -78,10 +78,10 @@ NS_ASSUME_NONNULL_BEGIN - (git_reference *)git_reference __attribute__((objc_returns_inner_pointer)); /// The target (either GTObject or GTReference) to which the reference points. -@property (nonatomic, readonly, copy) id unresolvedTarget; +@property (nonatomic, readonly, copy, nullable) id unresolvedTarget; /// The resolved object to which the reference points. -@property (nonatomic, readonly, copy) id resolvedTarget; +@property (nonatomic, readonly, copy, nullable) id resolvedTarget; /// The last direct reference in a chain @property (nonatomic, readonly, copy) GTReference *resolvedReference; diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index b98137207..971086255 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -177,7 +177,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { @interface GTRepository : NSObject /// The file URL for the repository's working directory. -@property (nonatomic, readonly, strong) NSURL *fileURL; +@property (nonatomic, readonly, strong, nullable) NSURL *fileURL; /// The file URL for the repository's .git directory. @property (nonatomic, readonly, strong, nullable) NSURL *gitDirectoryURL; diff --git a/ObjectiveGit/GTSignature.h b/ObjectiveGit/GTSignature.h index ab6b852ff..910af1a5c 100644 --- a/ObjectiveGit/GTSignature.h +++ b/ObjectiveGit/GTSignature.h @@ -42,10 +42,10 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly, copy, nullable) NSString *email; /// The time when the action happened. -@property (nonatomic, readonly, strong) NSDate *time; +@property (nonatomic, readonly, strong, nullable) NSDate *time; /// The time zone that `time` should be interpreted relative to. -@property (nonatomic, readonly, copy) NSTimeZone *timeZone; +@property (nonatomic, readonly, copy, nullable) NSTimeZone *timeZone; /// Initializes the receiver with the given signature. /// From 2fea0a5f762c857e18d326c750bcf1a245abc3ca Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Fri, 2 Dec 2016 16:23:54 +0300 Subject: [PATCH 096/228] Fix nullability warning for GTNote --- ObjectiveGit/GTNote.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTNote.h b/ObjectiveGit/GTNote.h index 1d9800e55..4727f6719 100644 --- a/ObjectiveGit/GTNote.h +++ b/ObjectiveGit/GTNote.h @@ -85,7 +85,7 @@ NS_ASSUME_NONNULL_BEGIN /// May be NULL. /// /// Returns default reference name (usually "refs/notes/commits"). -+ (NSString *)defaultReferenceNameForRepository:(GTRepository *)repository error:(NSError **)error; ++ (nullable NSString *)defaultReferenceNameForRepository:(GTRepository *)repository error:(NSError **)error; @end From 5bf9d5f3dc9e4230585c31f0c12bb657a24667a3 Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Fri, 2 Dec 2016 17:49:03 +0300 Subject: [PATCH 097/228] Corrections per @tiennou feedback --- ObjectiveGit/GTNote.h | 6 ++-- ObjectiveGit/GTNote.m | 31 +++++++----------- ObjectiveGit/GTRepository+RemoteOperations.h | 27 ++++------------ ObjectiveGit/GTRepository+RemoteOperations.m | 33 +++++++++++++------- ObjectiveGit/GTRepository.m | 33 +++++++++----------- 5 files changed, 55 insertions(+), 75 deletions(-) diff --git a/ObjectiveGit/GTNote.h b/ObjectiveGit/GTNote.h index 4727f6719..bf7d5c7e6 100644 --- a/ObjectiveGit/GTNote.h +++ b/ObjectiveGit/GTNote.h @@ -69,11 +69,9 @@ NS_ASSUME_NONNULL_BEGIN /// oid - git_oid of the target to attach to /// repository - Repository containing the target OID refers to /// referenceName - Name for the notes reference in the repo, or NULL for default ("refs/notes/commits") -/// error - Will be filled with a git error code in case of error. -/// May be NULL. /// -/// Returns initialized GTNote instance or nil on failure (error will be populated, if passed). -- (nullable instancetype)initWithTargetGitOID:(git_oid *)oid repository:(git_repository *)repository referenceName:(const char * _Nullable)referenceName error:(int * _Nullable)error; +/// Returns initialized GTNote instance or nil on failure. +- (nullable instancetype)initWithTargetGitOID:(git_oid *)oid repository:(git_repository *)repository referenceName:(const char * _Nullable)referenceName; - (instancetype)init NS_UNAVAILABLE; diff --git a/ObjectiveGit/GTNote.m b/ObjectiveGit/GTNote.m index b0ef6d365..9ee9b2fd4 100644 --- a/ObjectiveGit/GTNote.m +++ b/ObjectiveGit/GTNote.m @@ -58,28 +58,25 @@ - (GTOID *)targetOID { } - (instancetype)initWithTargetOID:(GTOID *)oid repository:(GTRepository *)repository referenceName:(NSString *)referenceName error:(NSError **)error { - int err = GIT_OK; + self = [super init]; + if (self == nil) return nil; - id object = [self initWithTargetGitOID:(git_oid *)oid.git_oid repository:repository.git_repository referenceName:referenceName.UTF8String error:&err]; + int gitErr = git_note_read(&_note, repository.git_repository, referenceName.UTF8String, oid.git_oid); - if (err != GIT_OK && error != NULL) { - *error = [NSError git_errorFor:err description:@"Failed to create a note."]; - } + if (gitErr != GIT_OK && error != NULL) *error = [NSError git_errorFor:gitErr description:@"Failed to read a note."]; - return object; + if (gitErr != GIT_OK) return nil; + + return self; } -- (instancetype)initWithTargetGitOID:(git_oid *)oid repository:(git_repository *)repository referenceName:(const char *)referenceName error:(int *)error { +- (instancetype)initWithTargetGitOID:(git_oid *)oid repository:(git_repository *)repository referenceName:(const char *)referenceName { self = [super init]; if (self == nil) return nil; int gitErr = git_note_read(&_note, repository, referenceName, oid); - if (gitErr != GIT_OK) { - if (error != NULL) *error = gitErr; - - return nil; - } + if (gitErr != GIT_OK) return nil; return self; } @@ -95,11 +92,7 @@ + (NSString *)defaultReferenceNameForRepository:(GTRepository *)repository error git_buf default_ref_name = { 0 }; int gitErr = git_note_default_ref(&default_ref_name, repository.git_repository); if (gitErr != GIT_OK) { - git_buf_free(&default_ref_name); - - if (error != NULL) { - *error = [NSError git_errorFor:gitErr description:@"Unable to get default git notes reference name"]; - } + if (error != NULL) *error = [NSError git_errorFor:gitErr description:@"Unable to get default git notes reference name"]; return nil; } @@ -107,9 +100,7 @@ + (NSString *)defaultReferenceNameForRepository:(GTRepository *)repository error if (default_ref_name.ptr != NULL) { noteRef = @(default_ref_name.ptr); } else { - if (error != NULL) { - *error = [NSError git_errorFor:GIT_ERROR description:@"Unable to get default git notes reference name"]; - } + if (error != NULL) *error = [NSError git_errorFor:GIT_ERROR description:@"Unable to get default git notes reference name"]; } git_buf_free(&default_ref_name); diff --git a/ObjectiveGit/GTRepository+RemoteOperations.h b/ObjectiveGit/GTRepository+RemoteOperations.h index 32cb8cbe7..86fbdfd0e 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.h +++ b/ObjectiveGit/GTRepository+RemoteOperations.h @@ -22,6 +22,9 @@ extern NSString *const GTRepositoryRemoteOptionsFetchPrune; /// A `GTRemoteAutoTagOption`, that will be used to determine how the fetch should handle tags. extern NSString *const GTRepositoryRemoteOptionsDownloadTags; +/// A `@(BOOL)`, indicating git notes should also be pushed to the default notes reference name (if `@(YES)`), or an `NSArray(NSString)` containing reference names to be pushed through. +extern NSString *const GTRepositoryRemoteOptionsPushNotes; + /// An enum describing the data needed for pruning. /// See `git_fetch_prune_t`. typedef NS_ENUM(NSInteger, GTFetchPruneOption) { @@ -76,6 +79,7 @@ typedef NS_ENUM(NSInteger, GTFetchPruneOption) { /// options - Options applied to the push operation. Can be NULL. /// Recognized options are: /// `GTRepositoryRemoteOptionsCredentialProvider` +/// `GTRepositoryRemoteOptionsPushNotes` (to push together with notes in one push) /// error - The error if one occurred. Can be NULL. /// progressBlock - An optional callback for monitoring progress. May be NULL. /// @@ -89,7 +93,8 @@ typedef NS_ENUM(NSInteger, GTFetchPruneOption) { /// remote - The remote to push to. Must not be nil. /// options - Options applied to the push operation. Can be NULL. /// Recognized options are: -/// `GTRepositoryRemoteOptionsCredentialProvider` +/// `GTRepositoryRemoteOptionsCredentialProvider`, +/// `GTRepositoryRemoteOptionsPushNotes` (to push together with notes in one push) /// error - The error if one occurred. Can be NULL. /// progressBlock - An optional callback for monitoring progress. May be NULL. /// @@ -97,26 +102,6 @@ typedef NS_ENUM(NSInteger, GTFetchPruneOption) { /// will point to an error describing what happened). - (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options error:(NSError **)error progress:(nullable void (^)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop))progressBlock; -/// Push an array of branches to a remote, together with notes (in one push). -/// Normally, if you use Git notes functionality, to push the notes to remote, you would have to -/// do two operations: pushBranches followed by pushNotes. This is unrational, so we offer you a handy -/// shortcut that allows to push the branches together with the notes. -/// -/// branches - An array of branches to push. Must not be nil. -/// remote - The remote to push to. Must not be nil. -/// options - Options applied to the push operation. Can be NULL. -/// Recognized options are: -/// `GTRepositoryRemoteOptionsCredentialProvider` -/// referenceName - Reference name for notes, if they should be pushed together with the branches. -/// Use +[GTNote defaultReferenceNameWithError:] to push the default note reference. -/// Passing NULL here will make notes NOT to be pushed. -/// error - The error if one occurred. Can be NULL. -/// progressBlock - An optional callback for monitoring progress. May be NULL. -/// -/// Returns YES if the push was successful, NO otherwise (and `error`, if provided, -/// will point to an error describing what happened). -- (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options withNotesReferenceName:(nullable NSString *)notesReferenceName error:(NSError **)error progress:(nullable void (^)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop))progressBlock; - /// Push a given Git notes reference name to a remote. /// /// noteReferenceName - Name of the notes reference. If NULL, will default to whatever the default is (e.g. "refs/notes/commits") diff --git a/ObjectiveGit/GTRepository+RemoteOperations.m b/ObjectiveGit/GTRepository+RemoteOperations.m index 568ba32ca..327dbcd30 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.m +++ b/ObjectiveGit/GTRepository+RemoteOperations.m @@ -28,6 +28,7 @@ NSString *const GTRepositoryRemoteOptionsCredentialProvider = @"GTRepositoryRemoteOptionsCredentialProvider"; NSString *const GTRepositoryRemoteOptionsFetchPrune = @"GTRepositoryRemoteOptionsFetchPrune"; NSString *const GTRepositoryRemoteOptionsDownloadTags = @"GTRepositoryRemoteOptionsDownloadTags"; +NSString *const GTRepositoryRemoteOptionsPushNotes = @"GTRepositoryRemoteOptionsPushNotes"; typedef void (^GTRemoteFetchTransferProgressBlock)(const git_transfer_progress *stats, BOOL *stop); typedef void (^GTRemotePushTransferProgressBlock)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop); @@ -175,10 +176,6 @@ - (BOOL)pushBranch:(GTBranch *)branch toRemote:(GTRemote *)remote withOptions:(N } - (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error:(NSError **)error progress:(GTRemotePushTransferProgressBlock)progressBlock { - return [self pushBranches:branches toRemote:remote withOptions:options withNotesReferenceName:nil error:error progress:progressBlock]; -} - -- (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(NSDictionary *)options withNotesReferenceName:(NSString *)referenceName error:(NSError **)error progress:(GTRemotePushTransferProgressBlock)progressBlock { NSParameterAssert(branches != nil); NSParameterAssert(branches.count != 0); NSParameterAssert(remote != nil); @@ -202,13 +199,27 @@ - (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions [refspecs addObject:[NSString stringWithFormat:@"refs/heads/%@:%@", branch.shortName, remoteBranchReference]]; } - // Also push the notes reference, if needed. - if (referenceName != nil) { - // but check whether the reference exists for the repo, otherwise, our push will fail - GTReference *notesRef = [self lookUpReferenceWithName:referenceName error:nil]; - - if (notesRef != nil) { - [refspecs addObject:[NSString stringWithFormat:@"%@:%@", referenceName, referenceName]]; + // Also push the notes reference(s), if needed. + id pushNotesOption = options[GTRepositoryRemoteOptionsPushNotes]; + if (pushNotesOption != nil) { + if ([pushNotesOption isKindOfClass:[NSNumber class]]) { // Push notes is a bool, only push the default reference name if it's YES + if ([(NSNumber *)pushNotesOption boolValue]) { + NSString *notesReferenceName = [GTNote defaultReferenceNameForRepository:self error:nil]; + + // Check whether the reference name exists for the repo, or our push will fail + if (notesReferenceName != nil && [self lookUpReferenceWithName:notesReferenceName error:nil] != nil) { + [refspecs addObject:[NSString stringWithFormat:@"%@:%@", notesReferenceName, notesReferenceName]]; + } + } + } else if ([pushNotesOption isKindOfClass:[NSArray class]]) { + for (NSString *notesReferenceName in (NSArray *)pushNotesOption) { + if ([notesReferenceName isKindOfClass:[NSString class]]) { // Just a sanity check, we only accept NSStrings in the array + // Check whether the reference name exists for the repo, or our push will fail + if (notesReferenceName != nil && [self lookUpReferenceWithName:notesReferenceName error:nil] != nil) { + [refspecs addObject:[NSString stringWithFormat:@"%@:%@", notesReferenceName, notesReferenceName]]; + } + } + } } } diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 1bdc5c737..98b4f8e4a 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -54,6 +54,8 @@ #import "GTRepository+References.h" #import "GTNote.h" +#import "EXTScope.h" + #import "git2.h" NSString * const GTRepositoryCloneOptionsBare = @"GTRepositoryCloneOptionsBare"; @@ -974,38 +976,36 @@ - (BOOL)removeNoteFromObject:(GTObject *)parentObject referenceName:(NSString *) return YES; } -- (BOOL)enumerateNotesWithReferenceName:(NSString *)referenceName error:(NSError **)error usingBlock:(void (^)(GTNote *note, GTObject *object, BOOL *stop))block -{ +- (BOOL)enumerateNotesWithReferenceName:(NSString *)referenceName error:(NSError **)error usingBlock:(void (^)(GTNote *note, GTObject *object, BOOL *stop))block { git_note_iterator *iter = NULL; int gitError = git_note_iterator_new(&iter, self.git_repository, referenceName.UTF8String); if (gitError != GIT_OK) { - if(error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to enumerate notes"]; + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to enumerate notes"]; return NO; } + @onExit { + git_note_iterator_free(iter); + }; + git_oid note_id; git_oid object_id; BOOL success = YES; int iterError = GIT_OK; while ((iterError = git_note_next(¬e_id, &object_id, iter)) == GIT_OK) { - NSError* lookupErr = nil; + NSError *lookupErr = nil; - GTNote* note = [[GTNote alloc] initWithTargetGitOID:&object_id repository:self.git_repository referenceName:referenceName.UTF8String error:&gitError]; - if (note == nil) { - if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Cannot find a note"]; - success = NO; - break; - } + GTNote *note = [[GTNote alloc] initWithTargetOID:[GTOID oidWithGitOid:&object_id] repository:self referenceName:referenceName error:error]; + if (note == nil) return NO; - GTObject* obj = [self lookUpObjectByGitOid:&object_id error:&lookupErr]; + GTObject *obj = [self lookUpObjectByGitOid:&object_id error:&lookupErr]; if (obj == nil && lookupErr != nil) { if (error != NULL) *error = lookupErr; - success = NO; - break; + return NO; } BOOL stop = NO; @@ -1015,12 +1015,7 @@ - (BOOL)enumerateNotesWithReferenceName:(NSString *)referenceName error:(NSError } } - git_note_iterator_free(iter); - - if (iterError != GIT_OK && iterError != GIT_ITEROVER) { - if (error != NULL) - *error = [NSError git_errorFor:iterError description:@"Iterator error"]; - } + if (iterError != GIT_OK && iterError != GIT_ITEROVER && error != NULL) *error = [NSError git_errorFor:iterError description:@"Iterator error"]; return success; } From f4a110395ebd2e8297fcc294028f03539734a71f Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Fri, 2 Dec 2016 17:56:43 +0300 Subject: [PATCH 098/228] Rollback libgit2 back to globally used release --- External/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libgit2 b/External/libgit2 index 661db4f48..211e117a0 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit 661db4f4829a0fe1330f275de6e58c34589f512f +Subproject commit 211e117a0590583a720c53172406f34186c543bd From 55898a783876a9ca374c7ef8d017aed578732afe Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Sat, 3 Dec 2016 02:07:55 +0300 Subject: [PATCH 099/228] More fixes for pull request #576 --- ObjectiveGit/GTNote.h | 2 +- ObjectiveGit/GTNote.m | 19 ++++++--------- ObjectiveGit/GTRepository.h | 2 +- ObjectiveGit/GTRepository.m | 23 ++++++++----------- .../project.pbxproj | 4 ---- ObjectiveGitTests/GTNoteSpec.m | 10 ++++---- 6 files changed, 24 insertions(+), 36 deletions(-) diff --git a/ObjectiveGit/GTNote.h b/ObjectiveGit/GTNote.h index bf7d5c7e6..509a2bbd1 100644 --- a/ObjectiveGit/GTNote.h +++ b/ObjectiveGit/GTNote.h @@ -71,7 +71,7 @@ NS_ASSUME_NONNULL_BEGIN /// referenceName - Name for the notes reference in the repo, or NULL for default ("refs/notes/commits") /// /// Returns initialized GTNote instance or nil on failure. -- (nullable instancetype)initWithTargetGitOID:(git_oid *)oid repository:(git_repository *)repository referenceName:(const char * _Nullable)referenceName; +- (nullable instancetype)initWithTargetGitOID:(git_oid *)oid repository:(git_repository *)repository referenceName:(const char * _Nullable)referenceName error:(NSError **)error NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; diff --git a/ObjectiveGit/GTNote.m b/ObjectiveGit/GTNote.m index 9ee9b2fd4..b273f9f1d 100644 --- a/ObjectiveGit/GTNote.m +++ b/ObjectiveGit/GTNote.m @@ -58,25 +58,20 @@ - (GTOID *)targetOID { } - (instancetype)initWithTargetOID:(GTOID *)oid repository:(GTRepository *)repository referenceName:(NSString *)referenceName error:(NSError **)error { - self = [super init]; - if (self == nil) return nil; - - int gitErr = git_note_read(&_note, repository.git_repository, referenceName.UTF8String, oid.git_oid); - - if (gitErr != GIT_OK && error != NULL) *error = [NSError git_errorFor:gitErr description:@"Failed to read a note."]; - - if (gitErr != GIT_OK) return nil; - - return self; + return [self initWithTargetGitOID:(git_oid *)oid.git_oid repository:repository.git_repository referenceName:referenceName.UTF8String error:error]; } -- (instancetype)initWithTargetGitOID:(git_oid *)oid repository:(git_repository *)repository referenceName:(const char *)referenceName { +- (instancetype)initWithTargetGitOID:(git_oid *)oid repository:(git_repository *)repository referenceName:(const char *)referenceName error:(NSError **)error { self = [super init]; if (self == nil) return nil; int gitErr = git_note_read(&_note, repository, referenceName, oid); - if (gitErr != GIT_OK) return nil; + if (gitErr != GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:gitErr description:@"Unable to read note"]; + + return nil; + } return self; } diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index 2989afa42..1d9a69b6d 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -667,7 +667,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// If the block sets `stop` to YES, the iterator is finished. /// /// Returns YES on overall success or NO on error of any kind. -- (BOOL)enumerateNotesWithReferenceName:(nullable NSString *)referenceName error:(NSError **)error usingBlock:(void (^)(GTNote *note, GTObject *object, BOOL *stop))block; +- (BOOL)enumerateNotesWithReferenceName:(nullable NSString *)referenceName error:(NSError **)error usingBlock:(void (^)(GTNote * __nullable note, GTObject * __nullable object, NSError * __nullable error, BOOL *stop))block; @end diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 98b4f8e4a..e983d4785 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -969,20 +969,19 @@ - (GTNote *)createNote:(NSString *)note target:(GTObject *)theTarget referenceNa - (BOOL)removeNoteFromObject:(GTObject *)parentObject referenceName:(NSString *)referenceName author:(GTSignature *)author committer:(GTSignature *)committer error:(NSError **)error { int gitError = git_note_remove(self.git_repository, referenceName.UTF8String, author.git_signature, committer.git_signature, parentObject.OID.git_oid); if (gitError != GIT_OK) { - if(error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to delete note from %@", parentObject]; + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to delete note from %@", parentObject]; return NO; } return YES; } -- (BOOL)enumerateNotesWithReferenceName:(NSString *)referenceName error:(NSError **)error usingBlock:(void (^)(GTNote *note, GTObject *object, BOOL *stop))block { +- (BOOL)enumerateNotesWithReferenceName:(NSString *)referenceName error:(NSError **)error usingBlock:(void (^)(GTNote *note, GTObject *object, NSError *error, BOOL *stop))block { git_note_iterator *iter = NULL; int gitError = git_note_iterator_new(&iter, self.git_repository, referenceName.UTF8String); - if (gitError != GIT_OK) - { + if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to enumerate notes"]; return NO; } @@ -999,23 +998,21 @@ - (BOOL)enumerateNotesWithReferenceName:(NSString *)referenceName error:(NSError while ((iterError = git_note_next(¬e_id, &object_id, iter)) == GIT_OK) { NSError *lookupErr = nil; - GTNote *note = [[GTNote alloc] initWithTargetOID:[GTOID oidWithGitOid:&object_id] repository:self referenceName:referenceName error:error]; - if (note == nil) return NO; + GTNote *note = [[GTNote alloc] initWithTargetOID:[GTOID oidWithGitOid:&object_id] repository:self referenceName:referenceName error:&lookupErr]; + GTObject *obj = nil; - GTObject *obj = [self lookUpObjectByGitOid:&object_id error:&lookupErr]; - if (obj == nil && lookupErr != nil) { - if (error != NULL) *error = lookupErr; - return NO; - } + if (note != nil) obj = [self lookUpObjectByGitOid:&object_id error:&lookupErr]; BOOL stop = NO; - block(note, obj, &stop); + block(note, obj, lookupErr, &stop); if (stop) { break; } } - if (iterError != GIT_OK && iterError != GIT_ITEROVER && error != NULL) *error = [NSError git_errorFor:iterError description:@"Iterator error"]; + if (iterError != GIT_OK && iterError != GIT_ITEROVER) { + if (error != NULL) *error = [NSError git_errorFor:iterError description:@"Iterator error"]; + } return success; } diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index e85bcf789..fb2b0912d 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -372,8 +372,6 @@ F964D5F21CE9D9B200F1D8DD /* GTNote.h in Headers */ = {isa = PBXBuildFile; fileRef = F964D5EF1CE9D9B200F1D8DD /* GTNote.h */; settings = {ATTRIBUTES = (Public, ); }; }; F964D5F31CE9D9B200F1D8DD /* GTNote.m in Sources */ = {isa = PBXBuildFile; fileRef = F964D5F01CE9D9B200F1D8DD /* GTNote.m */; }; F964D5F51CE9D9B200F1D8DD /* GTNote.m in Sources */ = {isa = PBXBuildFile; fileRef = F964D5F01CE9D9B200F1D8DD /* GTNote.m */; }; - F9D1D4231CEB79D1009E5855 /* GTNoteSpec.m in Resources */ = {isa = PBXBuildFile; fileRef = F9D1D4221CEB79D1009E5855 /* GTNoteSpec.m */; }; - F9D1D4241CEB79D1009E5855 /* GTNoteSpec.m in Resources */ = {isa = PBXBuildFile; fileRef = F9D1D4221CEB79D1009E5855 /* GTNoteSpec.m */; }; F9D1D4251CEB7BA6009E5855 /* GTNoteSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F9D1D4221CEB79D1009E5855 /* GTNoteSpec.m */; }; /* End PBXBuildFile section */ @@ -1322,7 +1320,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - F9D1D4231CEB79D1009E5855 /* GTNoteSpec.m in Resources */, D09C2E51175602A500065E36 /* fixtures.zip in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1339,7 +1336,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - F9D1D4241CEB79D1009E5855 /* GTNoteSpec.m in Resources */, F8D007A81B4FA045009A8DAF /* fixtures.zip in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/ObjectiveGitTests/GTNoteSpec.m b/ObjectiveGitTests/GTNoteSpec.m index c096f35b0..f3edbc6cb 100644 --- a/ObjectiveGitTests/GTNoteSpec.m +++ b/ObjectiveGitTests/GTNoteSpec.m @@ -37,10 +37,10 @@ it(@"can create notes", ^{ // Annotate the commit - GTSignature* sig = [repository userSignatureForNow]; + GTSignature *sig = [repository userSignatureForNow]; expect(sig).notTo(beNil()); - NSError* err = nil; + NSError *err = nil; GTNote *note = [repository createNote:@"Note text" target:initialCommit referenceName:nil author:sig committer:sig overwriteIfExists:YES error:&err]; expect(note).notTo(beNil()); @@ -57,10 +57,10 @@ it(@"can delete notes", ^{ // Annotate the commit - GTSignature* sig = [repository userSignatureForNow]; + GTSignature *sig = [repository userSignatureForNow]; expect(sig).notTo(beNil()); - NSError* err = nil; + NSError *err = nil; GTNote *note = [repository createNote:@"Note text" target:initialCommit referenceName:nil author:sig committer:sig overwriteIfExists:YES error:&err]; expect(note).notTo(beNil()); @@ -70,7 +70,7 @@ expect(@(res)).to(beTrue()); expect(err).to(beNil()); - NSMutableArray* notes = [NSMutableArray arrayWithCapacity:0]; + NSMutableArray *notes = [NSMutableArray arrayWithCapacity:0]; [repository enumerateNotesWithReferenceName:nil error:&err usingBlock:^(GTNote *note, GTObject *object, BOOL *stop) { [notes addObject:note]; From 16f980f279d411fc1cf7fd2f826e4f40812892b4 Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Sat, 3 Dec 2016 02:13:49 +0300 Subject: [PATCH 100/228] Extra newlines removal --- ObjectiveGit/GTNote.m | 2 -- 1 file changed, 2 deletions(-) diff --git a/ObjectiveGit/GTNote.m b/ObjectiveGit/GTNote.m index b273f9f1d..0c18fe2b5 100644 --- a/ObjectiveGit/GTNote.m +++ b/ObjectiveGit/GTNote.m @@ -69,7 +69,6 @@ - (instancetype)initWithTargetGitOID:(git_oid *)oid repository:(git_repository * if (gitErr != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitErr description:@"Unable to read note"]; - return nil; } @@ -88,7 +87,6 @@ + (NSString *)defaultReferenceNameForRepository:(GTRepository *)repository error int gitErr = git_note_default_ref(&default_ref_name, repository.git_repository); if (gitErr != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitErr description:@"Unable to get default git notes reference name"]; - return nil; } From 927cc49b35e3c4ded9c271d19d08d83feea0e64c Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Sun, 4 Dec 2016 15:23:28 +0300 Subject: [PATCH 101/228] Fix tests for GTNote --- ObjectiveGitTests/GTNoteSpec.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ObjectiveGitTests/GTNoteSpec.m b/ObjectiveGitTests/GTNoteSpec.m index f3edbc6cb..e2d225108 100644 --- a/ObjectiveGitTests/GTNoteSpec.m +++ b/ObjectiveGitTests/GTNoteSpec.m @@ -46,7 +46,8 @@ expect(note).notTo(beNil()); expect(err).to(beNil()); - [repository enumerateNotesWithReferenceName:nil error:&err usingBlock:^(GTNote *note, GTObject *object, BOOL *stop) { + [repository enumerateNotesWithReferenceName:nil error:&err usingBlock:^(GTNote *note, GTObject *object, NSError *error, BOOL *stop) { + expect(error).to(beNil()); expect(note).notTo(beNil()); expect(object).notTo(beNil()); @@ -72,7 +73,7 @@ NSMutableArray *notes = [NSMutableArray arrayWithCapacity:0]; - [repository enumerateNotesWithReferenceName:nil error:&err usingBlock:^(GTNote *note, GTObject *object, BOOL *stop) { + [repository enumerateNotesWithReferenceName:nil error:&err usingBlock:^(GTNote *note, GTObject *object, NSError *error, BOOL *stop) { [notes addObject:note]; }]; From 2166c25252a46bb1bd101fa25ce53b9f46f4931a Mon Sep 17 00:00:00 2001 From: David Catmull Date: Mon, 5 Dec 2016 09:06:50 -0700 Subject: [PATCH 102/228] GTObject GTIndexEntry initializers should be nullable --- ObjectiveGit/GTIndexEntry.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ObjectiveGit/GTIndexEntry.h b/ObjectiveGit/GTIndexEntry.h index de9abf1ec..2646c5475 100644 --- a/ObjectiveGit/GTIndexEntry.h +++ b/ObjectiveGit/GTIndexEntry.h @@ -86,8 +86,8 @@ NS_ASSUME_NONNULL_BEGIN @interface GTObject (GTIndexEntry) -+ (instancetype)objectWithIndexEntry:(GTIndexEntry *)treeEntry error:(NSError **)error; -- (instancetype)initWithIndexEntry:(GTIndexEntry *)treeEntry error:(NSError **)error; ++ (nullable instancetype)objectWithIndexEntry:(GTIndexEntry *)treeEntry error:(NSError **)error; +- (nullable instancetype)initWithIndexEntry:(GTIndexEntry *)treeEntry error:(NSError **)error; @end From fedb0ab5b5bf1501514223a3e1871ce64af18332 Mon Sep 17 00:00:00 2001 From: David Catmull Date: Mon, 5 Dec 2016 12:19:58 -0700 Subject: [PATCH 103/228] Also fix the parameter name --- ObjectiveGit/GTIndexEntry.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ObjectiveGit/GTIndexEntry.h b/ObjectiveGit/GTIndexEntry.h index 2646c5475..8b5ff9f23 100644 --- a/ObjectiveGit/GTIndexEntry.h +++ b/ObjectiveGit/GTIndexEntry.h @@ -86,8 +86,8 @@ NS_ASSUME_NONNULL_BEGIN @interface GTObject (GTIndexEntry) -+ (nullable instancetype)objectWithIndexEntry:(GTIndexEntry *)treeEntry error:(NSError **)error; -- (nullable instancetype)initWithIndexEntry:(GTIndexEntry *)treeEntry error:(NSError **)error; ++ (nullable instancetype)objectWithIndexEntry:(GTIndexEntry *)indexEntry error:(NSError **)error; +- (nullable instancetype)initWithIndexEntry:(GTIndexEntry *)indexEntry error:(NSError **)error; @end From aa0217635a0f7d21a927a5022c012628f42327dc Mon Sep 17 00:00:00 2001 From: Matt Rubin Date: Sun, 11 Dec 2016 12:24:08 -0800 Subject: [PATCH 104/228] Clean up whitespace in script/update_libgit2 --- script/update_libgit2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/update_libgit2 b/script/update_libgit2 index 0f795bc1f..d84cb1de1 100755 --- a/script/update_libgit2 +++ b/script/update_libgit2 @@ -23,10 +23,10 @@ mkdir build cd build cmake -DBUILD_SHARED_LIBS:BOOL=OFF \ - -DLIBSSH2_INCLUDE_DIRS:PATH=/usr/local/include/ \ - -DBUILD_CLAR:BOOL=OFF \ - -DTHREADSAFE:BOOL=ON \ - .. + -DLIBSSH2_INCLUDE_DIRS:PATH=/usr/local/include/ \ + -DBUILD_CLAR:BOOL=OFF \ + -DTHREADSAFE:BOOL=ON \ + .. cmake --build . product="libgit2.a" From 6adb8f8658f6818faec78f9d3747f1a42f11b4b1 Mon Sep 17 00:00:00 2001 From: Matt Rubin Date: Sun, 11 Dec 2016 12:28:13 -0800 Subject: [PATCH 105/228] Remove xctool from the script/bootstrap required tools The cibuild uses xcodebuild instead of xctool, as of https://github.com/libgit2/objective-git/commit/6f802a4b82c634f115b7f941d697ccee3f557a8b --- script/bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/bootstrap b/script/bootstrap index 84b7dd60d..1f3ea6ebb 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -10,7 +10,7 @@ config () { # A whitespace-separated list of executables that must be present and locatable. # These will each be installed through Homebrew if not found. - : ${REQUIRED_TOOLS="xctool cmake libssh2 libtool autoconf automake pkg-config"} + : ${REQUIRED_TOOLS="cmake libssh2 libtool autoconf automake pkg-config"} export REQUIRED_TOOLS } From 15c464ebcdcb41d156b3e21a013774cb9e2c5ead Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Thu, 15 Dec 2016 16:22:43 +0300 Subject: [PATCH 106/228] Fix mergeBranchIntoCurrentBranch for conflicted state checkout_opts passed to libgit2 missed a GIT_CHECKOUT_SAFE strategy, causing a dry run and only conflicted files being written out to the tree (losing all other non-conflicted ones). --- ObjectiveGit/GTRepository+Merging.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTRepository+Merging.m b/ObjectiveGit/GTRepository+Merging.m index aa4169e17..bb0c1fbb5 100644 --- a/ObjectiveGit/GTRepository+Merging.m +++ b/ObjectiveGit/GTRepository+Merging.m @@ -139,7 +139,7 @@ - (BOOL)mergeBranchIntoCurrentBranch:(GTBranch *)branch withError:(NSError **)er // Write conflicts git_merge_options merge_opts = GIT_MERGE_OPTIONS_INIT; git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT; - checkout_opts.checkout_strategy = GIT_CHECKOUT_ALLOW_CONFLICTS; + checkout_opts.checkout_strategy = (GIT_CHECKOUT_SAFE | GIT_CHECKOUT_ALLOW_CONFLICTS); git_annotated_commit *annotatedCommit; [self annotatedCommit:&annotatedCommit fromCommit:remoteCommit error:error]; From 11e5bb293fc9c345975b98288eb70b43bc9224b2 Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Mon, 5 Dec 2016 21:36:47 +0300 Subject: [PATCH 107/228] Add checkout strategy to stash apply/pop methods For a finer control over the unstash process, propogate checkout strategy to Objective-Git from the underlying libgit2 stash methods. --- ObjectiveGit/GTRepository+Stashing.h | 24 ++++++++++++++++++++++-- ObjectiveGit/GTRepository+Stashing.m | 13 +++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/ObjectiveGit/GTRepository+Stashing.h b/ObjectiveGit/GTRepository+Stashing.h index 31e73471a..6169a9aef 100644 --- a/ObjectiveGit/GTRepository+Stashing.h +++ b/ObjectiveGit/GTRepository+Stashing.h @@ -62,7 +62,7 @@ NS_ASSUME_NONNULL_BEGIN /// will cause enumeration to stop after the block returns. Must not be nil. - (void)enumerateStashesUsingBlock:(void (^)(NSUInteger index, NSString * __nullable message, GTOID * __nullable oid, BOOL *stop))block; -/// Apply stashed changes. +/// Apply stashed changes (with a default checkout strategy). /// /// index - The index of the stash to apply. 0 is the latest one. /// flags - The flags to use when applying the stash. @@ -71,7 +71,17 @@ NS_ASSUME_NONNULL_BEGIN /// Returns YES if the requested stash was successfully applied, NO otherwise. - (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock; -/// Pop stashed changes. +/// Apply stashed changes with a set checkout strategy. +/// +/// index - The index of the stash to apply. 0 is the latest one. +/// flags - The flags to use when applying the stash. +/// strategy - The checkout strategy to use when applying the stash. +/// error - If not NULL, set to any error that occurred. +/// +/// Returns YES if the requested stash was successfully applied, NO otherwise. +- (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags strategy:(GTCheckoutStrategyType)strategy error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock; + +/// Pop stashed changes (with a default checkout strategy). /// /// index - The index of the stash to apply. 0 is the most recent stash. /// flags - The flags to use when applying the stash. @@ -80,6 +90,16 @@ NS_ASSUME_NONNULL_BEGIN /// Returns YES if the requested stash was successfully applied, NO otherwise. - (BOOL)popStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock; +/// Pop stashed changes with a set checkout strategy. +/// +/// index - The index of the stash to apply. 0 is the most recent stash. +/// flags - The flags to use when applying the stash. +/// strategy - The checkout strategy to use when applying the stash. +/// error - If not NULL, set to any error that occurred. +/// +/// Returns YES if the requested stash was successfully applied, NO otherwise. +- (BOOL)popStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags strategy:(GTCheckoutStrategyType)strategy error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock; + /// Drop a stash from the repository's list of stashes. /// /// index - The index of the stash to drop, where 0 is the most recent stash. diff --git a/ObjectiveGit/GTRepository+Stashing.m b/ObjectiveGit/GTRepository+Stashing.m index 3f870130a..2f3a43dc5 100644 --- a/ObjectiveGit/GTRepository+Stashing.m +++ b/ObjectiveGit/GTRepository+Stashing.m @@ -60,9 +60,16 @@ static int stashApplyProgressCallback(git_stash_apply_progress_t progress, void } - (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock { + // GTCheckoutStrategyNone may sound odd at first, but this is what was passed in before (de-facto), and libgit2 has a sanity check to set it to GIT_CHECKOUT_SAFE if it's 0. + return [self applyStashAtIndex:index flags:flags strategy:GTCheckoutStrategyNone error:error progressBlock:progressBlock]; +} + +- (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags strategy:(GTCheckoutStrategyType)strategy error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock { git_stash_apply_options stash_options = GIT_STASH_APPLY_OPTIONS_INIT; stash_options.flags = (git_stash_apply_flags)flags; + stash_options.checkout_options.checkout_strategy = strategy; + if (progressBlock != nil) { stash_options.progress_cb = stashApplyProgressCallback; stash_options.progress_payload = (__bridge void *)progressBlock; @@ -77,9 +84,15 @@ - (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)fl } - (BOOL)popStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock { + // GTCheckoutStrategyNone may sound odd at first, but this is what was passed in before (de-facto), and libgit2 has a sanity check to set it to GIT_CHECKOUT_SAFE if it's 0. + return [self popStashAtIndex:index flags:flags strategy:GTCheckoutStrategyNone error:error progressBlock:progressBlock]; +} + +- (BOOL)popStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags strategy:(GTCheckoutStrategyType)strategy error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock { git_stash_apply_options stash_options = GIT_STASH_APPLY_OPTIONS_INIT; stash_options.flags = (git_stash_apply_flags)flags; + stash_options.checkout_options.checkout_strategy = strategy; if (progressBlock != nil) { stash_options.progress_cb = stashApplyProgressCallback; stash_options.progress_payload = (__bridge void *)progressBlock; From 1dc00629c6565e5ce0a5d29f31f12bf4659ae79d Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Mon, 5 Dec 2016 19:57:23 +0300 Subject: [PATCH 108/228] Fix typo in GTRepositoryStashApplyProgress MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GTRepositoryStashApplyProgressGheckoutUntracked -> GTRepositoryStashApplyProgressСheckoutUntracked --- ObjectiveGit/GTRepository+Stashing.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTRepository+Stashing.h b/ObjectiveGit/GTRepository+Stashing.h index 31e73471a..97f3e6474 100644 --- a/ObjectiveGit/GTRepository+Stashing.h +++ b/ObjectiveGit/GTRepository+Stashing.h @@ -35,7 +35,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStashApplyProgress) { GTRepositoryStashApplyProgressAnalyzeIndex = GIT_STASH_APPLY_PROGRESS_ANALYZE_INDEX, GTRepositoryStashApplyProgressAnalyzeModified = GIT_STASH_APPLY_PROGRESS_ANALYZE_MODIFIED, GTRepositoryStashApplyProgressAnalyzeUntracked = GIT_STASH_APPLY_PROGRESS_ANALYZE_UNTRACKED, - GTRepositoryStashApplyProgressGheckoutUntracked = GIT_STASH_APPLY_PROGRESS_CHECKOUT_UNTRACKED, + GTRepositoryStashApplyProgressCheckoutUntracked = GIT_STASH_APPLY_PROGRESS_CHECKOUT_UNTRACKED, GTRepositoryStashApplyProgressCheckoutModified = GIT_STASH_APPLY_PROGRESS_CHECKOUT_MODIFIED, GTRepositoryStashApplyProgressDone = GIT_STASH_APPLY_PROGRESS_DONE, }; From 9886cf83973f1fea7aba477db50446dc1f57bed8 Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Fri, 16 Dec 2016 16:24:22 +0300 Subject: [PATCH 109/228] =?UTF-8?q?Added=20-[GTRepository=20checkoutTree:?= =?UTF-8?q?=E2=80=A6]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ObjectiveGit/GTRepository.h | 16 +++++++++++++++- ObjectiveGit/GTRepository.m | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index 1d9a69b6d..874edc043 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -548,7 +548,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// Checkout a reference /// -/// targetCommit - The reference to checkout. +/// targetReference - The reference to checkout. /// strategy - The checkout strategy to use. /// notifyFlags - Flags that indicate which notifications should cause `notifyBlock` /// to be called. @@ -559,6 +559,20 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// Returns YES if operation was successful, NO otherwise - (BOOL)checkoutReference:(GTReference *)targetReference strategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags error:(NSError **)error progressBlock:(nullable void (^)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps))progressBlock notifyBlock:(nullable int (^)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir))notifyBlock; +/// Checkout a tree +/// +/// targetTree - The tree to checkout. +/// strategy - The checkout strategy to use. +/// notifyFlags - Flags that indicate which notifications should cause `notifyBlock` +/// to be called. +/// error - The error if one occurred. Can be NULL. +/// notifyBlock - The block to call back for notification handling. Can be nil. +/// progressBlock - The block to call back for progress updates. Can be nil. +/// +/// Returns YES if operation was successful, NO otherwise +/// Note: this operation will NOT update HEAD to newly checked out tree. +- (BOOL)checkoutTree:(GTTree *)targetTree strategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags error:(NSError **)error progressBlock:(nullable void (^)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps))progressBlock notifyBlock:(nullable int (^)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir))notifyBlock; + /// Convenience wrapper for checkoutCommit:strategy:notifyFlags:error:notifyBlock:progressBlock without notifications - (BOOL)checkoutCommit:(GTCommit *)target strategy:(GTCheckoutStrategyType)strategy error:(NSError **)error progressBlock:(nullable void (^)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps))progressBlock; diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index e983d4785..3955d9db9 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -868,6 +868,10 @@ - (BOOL)checkoutReference:(GTReference *)targetReference strategy:(GTCheckoutStr return [self moveHEADToReference:targetReference error:error]; } +- (BOOL)checkoutTree:(GTTree *)targetTree strategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags error:(NSError **)error progressBlock:(GTCheckoutProgressBlock)progressBlock notifyBlock:(GTCheckoutNotifyBlock)notifyBlock { + return [self performCheckout:targetTree withStrategy:strategy notifyFlags:notifyFlags error:error progressBlock:progressBlock notifyBlock:notifyBlock];; +} + - (BOOL)checkoutCommit:(GTCommit *)target strategy:(GTCheckoutStrategyType)strategy error:(NSError **)error progressBlock:(GTCheckoutProgressBlock)progressBlock { return [self checkoutCommit:target strategy:strategy notifyFlags:GTCheckoutNotifyNone error:error progressBlock:progressBlock notifyBlock:nil]; } From 279568ad2617de45a8d82ea1c4db600e04a5011b Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Mon, 19 Dec 2016 12:56:45 +0300 Subject: [PATCH 110/228] Typo fix. --- ObjectiveGit/GTRepository.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 3955d9db9..9f22ccbf8 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -869,7 +869,7 @@ - (BOOL)checkoutReference:(GTReference *)targetReference strategy:(GTCheckoutStr } - (BOOL)checkoutTree:(GTTree *)targetTree strategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags error:(NSError **)error progressBlock:(GTCheckoutProgressBlock)progressBlock notifyBlock:(GTCheckoutNotifyBlock)notifyBlock { - return [self performCheckout:targetTree withStrategy:strategy notifyFlags:notifyFlags error:error progressBlock:progressBlock notifyBlock:notifyBlock];; + return [self performCheckout:targetTree withStrategy:strategy notifyFlags:notifyFlags error:error progressBlock:progressBlock notifyBlock:notifyBlock]; } - (BOOL)checkoutCommit:(GTCommit *)target strategy:(GTCheckoutStrategyType)strategy error:(NSError **)error progressBlock:(GTCheckoutProgressBlock)progressBlock { From c0b634fec12b080f92eb70ba77aa9843e2dc4c00 Mon Sep 17 00:00:00 2001 From: David Catmull Date: Thu, 5 Jan 2017 16:17:49 -0700 Subject: [PATCH 111/228] Update to libgit2 0.25.0 --- External/libgit2 | 2 +- ObjectiveGit/GTRepository+RemoteOperations.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/External/libgit2 b/External/libgit2 index 211e117a0..75db289a0 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit 211e117a0590583a720c53172406f34186c543bd +Subproject commit 75db289a041b1f1084768244e167b953ac7eeaa5 diff --git a/ObjectiveGit/GTRepository+RemoteOperations.m b/ObjectiveGit/GTRepository+RemoteOperations.m index 327dbcd30..1d3024ce2 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.m +++ b/ObjectiveGit/GTRepository+RemoteOperations.m @@ -270,7 +270,7 @@ - (BOOL)pushRefspecs:(NSArray *)refspecs toRemote:(GTRemote *)remote withOptions remote_callbacks.push_transfer_progress = GTRemotePushTransferProgressCallback; remote_callbacks.payload = &connectionInfo, - gitError = git_remote_connect(remote.git_remote, GIT_DIRECTION_PUSH, &remote_callbacks, NULL); + gitError = git_remote_connect(remote.git_remote, GIT_DIRECTION_PUSH, &remote_callbacks, NULL, NULL); if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to connect remote"]; return NO; From e6abb591e357ab0012f830f05668b82fc9bc871f Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Tue, 10 Jan 2017 10:22:00 +0100 Subject: [PATCH 112/228] Update libgit2 to v0.25.1 --- External/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libgit2 b/External/libgit2 index 75db289a0..2fcb8705e 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit 75db289a041b1f1084768244e167b953ac7eeaa5 +Subproject commit 2fcb8705e584ca61f6c4657525c9d2713f6a39d2 From 311ca45e4d68958a7a56a81d4a671dec6692a2bc Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 10 Apr 2015 22:27:11 +0200 Subject: [PATCH 113/228] Wrap all the various way of doing checkouts in GTCheckoutOptions Fixes #457 --- ObjectiveGit/GTCheckoutOptions.h | 63 ++++++++++++ ObjectiveGit/GTCheckoutOptions.m | 97 ++++++++++++++++++ ObjectiveGit/GTRepository.h | 64 +++--------- ObjectiveGit/GTRepository.m | 98 +++++++------------ ObjectiveGit/ObjectiveGit.h | 1 + .../project.pbxproj | 12 +++ ObjectiveGitTests/GTFilterSpec.m | 2 +- ObjectiveGitTests/GTRepositorySpec.m | 11 ++- ObjectiveGitTests/GTSubmoduleSpec.m | 2 +- 9 files changed, 233 insertions(+), 117 deletions(-) create mode 100644 ObjectiveGit/GTCheckoutOptions.h create mode 100644 ObjectiveGit/GTCheckoutOptions.m diff --git a/ObjectiveGit/GTCheckoutOptions.h b/ObjectiveGit/GTCheckoutOptions.h new file mode 100644 index 000000000..6ab8f6b3d --- /dev/null +++ b/ObjectiveGit/GTCheckoutOptions.h @@ -0,0 +1,63 @@ +// +// GTCheckoutOptions.h +// ObjectiveGitFramework +// +// Created by Etienne on 10/04/2015. +// Copyright (c) 2015 GitHub, Inc. All rights reserved. +// + +#import +#import "git2/checkout.h" + +@class GTDiffFile; + +NS_ASSUME_NONNULL_BEGIN + +/// Checkout strategies used by the various -checkout... methods +/// See git_checkout_strategy_t +typedef NS_OPTIONS(NSInteger, GTCheckoutStrategyType) { + GTCheckoutStrategyNone = GIT_CHECKOUT_NONE, + GTCheckoutStrategySafe = GIT_CHECKOUT_SAFE, + GTCheckoutStrategyForce = GIT_CHECKOUT_FORCE, + GTCheckoutStrategyAllowConflicts = GIT_CHECKOUT_ALLOW_CONFLICTS, + GTCheckoutStrategyRemoveUntracked = GIT_CHECKOUT_REMOVE_UNTRACKED, + GTCheckoutStrategyRemoveIgnored = GIT_CHECKOUT_REMOVE_IGNORED, + GTCheckoutStrategyUpdateOnly = GIT_CHECKOUT_UPDATE_ONLY, + GTCheckoutStrategyDontUpdateIndex = GIT_CHECKOUT_DONT_UPDATE_INDEX, + GTCheckoutStrategyNoRefresh = GIT_CHECKOUT_NO_REFRESH, + GTCheckoutStrategyDisablePathspecMatch = GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH, + GTCheckoutStrategySkipLockedDirectories = GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES, +}; + +/// Checkout notification flags used by the various -checkout... methods +/// See git_checkout_notify_t +typedef NS_OPTIONS(NSInteger, GTCheckoutNotifyFlags) { + GTCheckoutNotifyNone = GIT_CHECKOUT_NOTIFY_NONE, + GTCheckoutNotifyConflict = GIT_CHECKOUT_NOTIFY_CONFLICT, + GTCheckoutNotifyDirty = GIT_CHECKOUT_NOTIFY_DIRTY, + GTCheckoutNotifyUpdated = GIT_CHECKOUT_NOTIFY_UPDATED, + GTCheckoutNotifyUntracked = GIT_CHECKOUT_NOTIFY_UNTRACKED, + GTCheckoutNotifyIgnored = GIT_CHECKOUT_NOTIFY_IGNORED, + + GTCheckoutNotifyAll = GIT_CHECKOUT_NOTIFY_ALL, +}; + +@interface GTCheckoutOptions : NSObject ++ (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags progressBlock:(nullable void (^)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps))progressBlock notifyBlock:(nullable int (^)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir))notifyBlock; + ++ (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags notifyBlock:(int (^)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir))notifyBlock; + ++ (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy progressBlock:(void (^)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps))progressBlock; + ++ (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy; + +- (git_checkout_options *)git_checkoutOptions NS_RETURNS_INNER_POINTER; + +@property (assign) GTCheckoutStrategyType strategy; +@property (copy) void (^progressBlock)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps); + +@property (assign) GTCheckoutNotifyFlags notifyFlags; +@property (copy) int (^notifyBlock)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir); +@end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/ObjectiveGit/GTCheckoutOptions.m b/ObjectiveGit/GTCheckoutOptions.m new file mode 100644 index 000000000..a20462992 --- /dev/null +++ b/ObjectiveGit/GTCheckoutOptions.m @@ -0,0 +1,97 @@ +// +// GTCheckoutOptions.m +// ObjectiveGitFramework +// +// Created by Etienne on 10/04/2015. +// Copyright (c) 2015 GitHub, Inc. All rights reserved. +// + +#import "GTCheckoutOptions.h" +#import "GTDiffFile.h" +#import "NSError+Git.h" +#import "git2.h" + +// The type of block set in progressBlock for progress reporting +typedef void (^GTCheckoutProgressBlock)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps); + +// The type of block set in notifyBlock for notification reporting +typedef int (^GTCheckoutNotifyBlock)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile * __nullable baseline, GTDiffFile * __nullable target, GTDiffFile * __nullable workdir); + + +@interface GTCheckoutOptions () { + git_checkout_options _git_checkoutOptions; +} +@end + +@implementation GTCheckoutOptions + ++ (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags progressBlock:(nullable GTCheckoutProgressBlock)progressBlock notifyBlock:(nullable GTCheckoutNotifyBlock)notifyBlock { + GTCheckoutOptions *options = [self checkoutOptionsWithStrategy:strategy]; + options.notifyFlags = notifyFlags; + options.notifyBlock = notifyBlock; + options.progressBlock = progressBlock; + return options; +} + ++ (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy progressBlock:(GTCheckoutProgressBlock)progressBlock { + NSParameterAssert(progressBlock != nil); + GTCheckoutOptions *options = [self checkoutOptionsWithStrategy:strategy]; + options.progressBlock = progressBlock; + return options; +} + ++ (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags notifyBlock:(GTCheckoutNotifyBlock)notifyBlock { + NSParameterAssert(notifyBlock != nil); + return [self checkoutOptionsWithStrategy:strategy notifyFlags:notifyFlags progressBlock:nil notifyBlock:notifyBlock]; +} + ++ (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy { + GTCheckoutOptions *options = [[self alloc] init]; + options.strategy = strategy; + return options; +} + +- (instancetype)init { + self = [super init]; + if (self == nil) return nil; + + _git_checkoutOptions.version = GIT_CHECKOUT_OPTIONS_VERSION; + + return self; +} + +static void GTCheckoutProgressCallback(const char *path, size_t completedSteps, size_t totalSteps, void *payload) { + if (payload == NULL) return; + void (^block)(NSString *, NSUInteger, NSUInteger) = (__bridge id)payload; + NSString *nsPath = (path != NULL ? [NSString stringWithUTF8String:path] : nil); + block(nsPath, completedSteps, totalSteps); +} + +static int GTCheckoutNotifyCallback(git_checkout_notify_t why, const char *path, const git_diff_file *baseline, const git_diff_file *target, const git_diff_file *workdir, void *payload) { + if (payload == NULL) return 0; + GTCheckoutNotifyBlock block = (__bridge id)payload; + NSString *nsPath = (path != NULL ? @(path) : nil); + GTDiffFile *gtBaseline = (baseline != NULL ? [[GTDiffFile alloc] initWithGitDiffFile:*baseline] : nil); + GTDiffFile *gtTarget = (target != NULL ? [[GTDiffFile alloc] initWithGitDiffFile:*target] : nil); + GTDiffFile *gtWorkdir = (workdir != NULL ? [[GTDiffFile alloc] initWithGitDiffFile:*workdir] : nil); + return block((GTCheckoutNotifyFlags)why, nsPath, gtBaseline, gtTarget, gtWorkdir); +} + +- (git_checkout_options *)git_checkoutOptions { + _git_checkoutOptions.checkout_strategy = self.strategy; + + if (self.progressBlock) { + _git_checkoutOptions.progress_cb = GTCheckoutProgressCallback; + _git_checkoutOptions.progress_payload = (__bridge void *)self.progressBlock; + } + + if (self.notifyBlock) { + _git_checkoutOptions.notify_cb = GTCheckoutNotifyCallback; + _git_checkoutOptions.notify_flags = self.notifyFlags; + _git_checkoutOptions.notify_payload = (__bridge void *)self.notifyBlock; + } + + return &_git_checkoutOptions; +} + +@end diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index 1d9a69b6d..bdf9a8ca8 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -34,6 +34,7 @@ #import "GTObject.h" #import "GTReference.h" #import "GTFilterList.h" +#import "GTCheckoutOptions.h" #import "git2/checkout.h" #import "git2/repository.h" #import "git2/transport.h" @@ -55,35 +56,6 @@ NS_ASSUME_NONNULL_BEGIN -/// Checkout strategies used by the various -checkout... methods -/// See git_checkout_strategy_t -typedef NS_OPTIONS(NSInteger, GTCheckoutStrategyType) { - GTCheckoutStrategyNone = GIT_CHECKOUT_NONE, - GTCheckoutStrategySafe = GIT_CHECKOUT_SAFE, - GTCheckoutStrategyForce = GIT_CHECKOUT_FORCE, - GTCheckoutStrategyAllowConflicts = GIT_CHECKOUT_ALLOW_CONFLICTS, - GTCheckoutStrategyRemoveUntracked = GIT_CHECKOUT_REMOVE_UNTRACKED, - GTCheckoutStrategyRemoveIgnored = GIT_CHECKOUT_REMOVE_IGNORED, - GTCheckoutStrategyUpdateOnly = GIT_CHECKOUT_UPDATE_ONLY, - GTCheckoutStrategyDontUpdateIndex = GIT_CHECKOUT_DONT_UPDATE_INDEX, - GTCheckoutStrategyNoRefresh = GIT_CHECKOUT_NO_REFRESH, - GTCheckoutStrategyDisablePathspecMatch = GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH, - GTCheckoutStrategySkipLockedDirectories = GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES, -}; - -/// Checkout notification flags used by the various -checkout... methods -/// See git_checkout_notify_t -typedef NS_OPTIONS(NSInteger, GTCheckoutNotifyFlags) { - GTCheckoutNotifyNone = GIT_CHECKOUT_NOTIFY_NONE, - GTCheckoutNotifyConflict = GIT_CHECKOUT_NOTIFY_CONFLICT, - GTCheckoutNotifyDirty = GIT_CHECKOUT_NOTIFY_DIRTY, - GTCheckoutNotifyUpdated = GIT_CHECKOUT_NOTIFY_UPDATED, - GTCheckoutNotifyUntracked = GIT_CHECKOUT_NOTIFY_UNTRACKED, - GTCheckoutNotifyIgnored = GIT_CHECKOUT_NOTIFY_IGNORED, - - GTCheckoutNotifyAll = GIT_CHECKOUT_NOTIFY_ALL, -}; - /// Transport flags sent as options to +cloneFromURL... method typedef NS_OPTIONS(NSInteger, GTTransportFlags) { GTTransportFlagsNone = GIT_TRANSPORTFLAGS_NONE @@ -101,6 +73,9 @@ extern NSString * const GTRepositoryCloneOptionsBare; /// Default value is `YES`. extern NSString * const GTRepositoryCloneOptionsCheckout; +/// A `GTCheckoutOptions` object describing how to perform the checkout. +extern NSString * const GTRepositoryCloneCheckoutOptions; + /// A `GTCredentialProvider`, that will be used to authenticate against the /// remote. extern NSString * const GTRepositoryCloneOptionsCredentialProvider; @@ -253,7 +228,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// options - A dictionary consisting of the options: /// `GTRepositoryCloneOptionsTransportFlags`, /// `GTRepositoryCloneOptionsBare`, -/// `GTRepositoryCloneOptionsCheckout`, +/// `GTRepositoryCloneCheckoutOptions`, /// `GTRepositoryCloneOptionsCredentialProvider`, /// `GTRepositoryCloneOptionsCloneLocal`, /// `GTRepositoryCloneOptionsServerCertificateURL` @@ -265,6 +240,9 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// May be NULL. /// /// returns nil (and fills the error parameter) if an error occurred, or a GTRepository object if successful. ++ (nullable instancetype)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(nullable NSDictionary *)options error:(NSError **)error transferProgressBlock:(nullable void (^)(const git_transfer_progress *, BOOL *stop))transferProgressBlock; + +/// Backward-compatible method that uses `GTRepositoryCloneOptionsCheckout` + (nullable instancetype)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(nullable NSDictionary *)options error:(NSError **)error transferProgressBlock:(nullable void (^)(const git_transfer_progress *, BOOL *stop))transferProgressBlock checkoutProgressBlock:(nullable void (^) (NSString *__nullable path, NSUInteger completedSteps, NSUInteger totalSteps))checkoutProgressBlock; /// Lookup objects in the repo by oid or sha1 @@ -536,34 +514,20 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// Checkout a commit /// /// targetCommit - The commit to checkout. Must not be nil. -/// strategy - The checkout strategy to use. -/// notifyFlags - Flags that indicate which notifications should cause `notifyBlock` -/// to be called. +/// options - The checkout options to use. Can be nil. /// error - The error if one occurred. Can be NULL. -/// notifyBlock - The block to call back for notification handling. Can be nil. -/// progressBlock - The block to call back for progress updates. Can be nil. /// /// Returns YES if operation was successful, NO otherwise -- (BOOL)checkoutCommit:(GTCommit *)targetCommit strategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags error:(NSError **)error progressBlock:(nullable void (^)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps))progressBlock notifyBlock:(nullable int (^)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir))notifyBlock; +- (BOOL)checkoutCommit:(GTCommit *)targetCommit options:(nullable GTCheckoutOptions *)options error:(NSError **)error; /// Checkout a reference /// -/// targetCommit - The reference to checkout. -/// strategy - The checkout strategy to use. -/// notifyFlags - Flags that indicate which notifications should cause `notifyBlock` -/// to be called. -/// error - The error if one occurred. Can be NULL. -/// notifyBlock - The block to call back for notification handling. Can be nil. -/// progressBlock - The block to call back for progress updates. Can be nil. +/// targetReference - The reference to checkout. Must not be nil. +/// options - The checkout options to use. Can be nil. +/// error - The error if one occurred. Can be NULL. /// /// Returns YES if operation was successful, NO otherwise -- (BOOL)checkoutReference:(GTReference *)targetReference strategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags error:(NSError **)error progressBlock:(nullable void (^)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps))progressBlock notifyBlock:(nullable int (^)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir))notifyBlock; - -/// Convenience wrapper for checkoutCommit:strategy:notifyFlags:error:notifyBlock:progressBlock without notifications -- (BOOL)checkoutCommit:(GTCommit *)target strategy:(GTCheckoutStrategyType)strategy error:(NSError **)error progressBlock:(nullable void (^)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps))progressBlock; - -/// Convenience wrapper for checkoutReference:strategy:notifyFlags:error:notifyBlock:progressBlock without notifications -- (BOOL)checkoutReference:(GTReference *)target strategy:(GTCheckoutStrategyType)strategy error:(NSError **)error progressBlock:(nullable void (^)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps))progressBlock; +- (BOOL)checkoutReference:(GTReference *)targetReference options:(nullable GTCheckoutOptions *)options error:(NSError **)error; /// Flush the gitattributes cache. - (void)flushAttributesCache; diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index e983d4785..0cf4399ce 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -31,6 +31,7 @@ #import "GTBlob.h" #import "GTBranch.h" +#import "GTCheckoutOptions.h" #import "GTCommit.h" #import "GTConfiguration+Private.h" #import "GTConfiguration.h" @@ -60,6 +61,7 @@ NSString * const GTRepositoryCloneOptionsBare = @"GTRepositoryCloneOptionsBare"; NSString * const GTRepositoryCloneOptionsCheckout = @"GTRepositoryCloneOptionsCheckout"; +NSString * const GTRepositoryCloneCheckoutOptions = @"GTRepositoryCloneCheckoutOptions"; NSString * const GTRepositoryCloneOptionsTransportFlags = @"GTRepositoryCloneOptionsTransportFlags"; NSString * const GTRepositoryCloneOptionsCredentialProvider = @"GTRepositoryCloneOptionsCredentialProvider"; NSString * const GTRepositoryCloneOptionsCloneLocal = @"GTRepositoryCloneOptionsCloneLocal"; @@ -212,18 +214,11 @@ - (instancetype)initWithURL:(NSURL *)localFileURL flags:(NSInteger)flags ceiling typedef void(^GTTransferProgressBlock)(const git_transfer_progress *progress, BOOL *stop); -static void checkoutProgressCallback(const char *path, size_t completedSteps, size_t totalSteps, void *payload) { - if (payload == NULL) return; - void (^block)(NSString *, NSUInteger, NSUInteger) = (__bridge id)payload; - NSString *nsPath = (path != NULL ? [NSString stringWithUTF8String:path] : nil); - block(nsPath, completedSteps, totalSteps); -} - static int transferProgressCallback(const git_transfer_progress *progress, void *payload) { if (payload == NULL) return 0; struct GTClonePayload *pld = payload; if (pld->transferProgressBlock == NULL) return 0; - + BOOL stop = NO; pld->transferProgressBlock(progress, &stop); return (stop ? GIT_EUSER : 0); @@ -243,22 +238,39 @@ static int remoteCreate(git_remote **remote, git_repository *repo, const char *n return GIT_OK; } -+ (instancetype)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(NSDictionary *)options error:(NSError **)error transferProgressBlock:(void (^)(const git_transfer_progress *, BOOL *stop))transferProgressBlock checkoutProgressBlock:(void (^)(NSString *__nullable path, NSUInteger completedSteps, NSUInteger totalSteps))checkoutProgressBlock { +struct GTRemoteCreatePayload { + git_remote_callbacks remoteCallbacks; +}; + +// Backward-compatibility with GTRepositoryCloneOptionsCheckout boolean ++ (nullable instancetype)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(nullable NSDictionary *)options error:(NSError **)error transferProgressBlock:(nullable void (^)(const git_transfer_progress *, BOOL *stop))transferProgressBlock checkoutProgressBlock:(nullable void (^)(NSString *__nullable path, NSUInteger completedSteps, NSUInteger totalSteps))checkoutProgressBlock { + NSNumber *checkout = options[GTRepositoryCloneOptionsCheckout]; + BOOL doCheckout = (checkout == nil ? YES : [checkout boolValue]); + if (doCheckout) { + GTCheckoutOptions *checkoutOptions = nil; + if (checkoutProgressBlock) { + checkoutOptions = [GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategySafe progressBlock:checkoutProgressBlock]; + } else { + checkoutOptions = [GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategySafe]; + } + + NSMutableDictionary *mutableOptions = [options mutableCopy]; + mutableOptions[GTRepositoryCloneCheckoutOptions] = checkoutOptions; + options = mutableOptions; + } + return [self cloneFromURL:originURL toWorkingDirectory:workdirURL options:options error:error transferProgressBlock:transferProgressBlock]; +} + ++ (nullable instancetype)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(nullable NSDictionary *)options error:(NSError **)error transferProgressBlock:(nullable void (^)(const git_transfer_progress *, BOOL *stop))transferProgressBlock { git_clone_options cloneOptions = GIT_CLONE_OPTIONS_INIT; NSNumber *bare = options[GTRepositoryCloneOptionsBare]; cloneOptions.bare = (bare == nil ? 0 : bare.boolValue); - NSNumber *checkout = options[GTRepositoryCloneOptionsCheckout]; - BOOL withCheckout = (checkout == nil ? YES : checkout.boolValue); - - if (withCheckout) { - git_checkout_options checkoutOptions = GIT_CHECKOUT_OPTIONS_INIT; - checkoutOptions.checkout_strategy = GIT_CHECKOUT_SAFE; - checkoutOptions.progress_cb = checkoutProgressCallback; - checkoutOptions.progress_payload = (__bridge void *)checkoutProgressBlock; - cloneOptions.checkout_opts = checkoutOptions; + GTCheckoutOptions *checkoutOptions = options[GTRepositoryCloneCheckoutOptions]; + if (checkoutOptions != nil) { + cloneOptions.checkout_opts = *(checkoutOptions.git_checkoutOptions); } GTCredentialProvider *provider = options[GTRepositoryCloneOptionsCredentialProvider]; @@ -284,7 +296,7 @@ + (instancetype)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)work if (localClone) { cloneOptions.local = GIT_CLONE_NO_LOCAL; } - + NSURL *serverCertificateURL = options[GTRepositoryCloneOptionsServerCertificateURL]; if (serverCertificateURL) { int gitError = git_libgit2_opts(GIT_OPT_SET_SSL_CERT_LOCATIONS, serverCertificateURL.fileSystemRepresentation, NULL); @@ -795,22 +807,6 @@ - (GTTag *)createTagNamed:(NSString *)tagName target:(GTObject *)theTarget tagge #pragma mark Checkout -// The type of block passed to -checkout:strategy:progressBlock:notifyBlock:notifyFlags:error: for progress reporting -typedef void (^GTCheckoutProgressBlock)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps); - -// The type of block passed to -checkout:strategy:progressBlock:notifyBlock:notifyFlags:error: for notification reporting -typedef int (^GTCheckoutNotifyBlock)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir); - -static int checkoutNotifyCallback(git_checkout_notify_t why, const char *path, const git_diff_file *baseline, const git_diff_file *target, const git_diff_file *workdir, void *payload) { - if (payload == NULL) return 0; - GTCheckoutNotifyBlock block = (__bridge id)payload; - NSString *nsPath = (path != NULL ? @(path) : nil); - GTDiffFile *gtBaseline = (baseline != NULL ? [[GTDiffFile alloc] initWithGitDiffFile:*baseline] : nil); - GTDiffFile *gtTarget = (target != NULL ? [[GTDiffFile alloc] initWithGitDiffFile:*target] : nil); - GTDiffFile *gtWorkdir = (workdir != NULL ? [[GTDiffFile alloc] initWithGitDiffFile:*workdir] : nil); - return block((GTCheckoutNotifyFlags)why, nsPath, gtBaseline, gtTarget, gtWorkdir); -} - - (BOOL)moveHEADToReference:(GTReference *)reference error:(NSError **)error { NSParameterAssert(reference != nil); @@ -833,49 +829,29 @@ - (BOOL)moveHEADToCommit:(GTCommit *)commit error:(NSError **)error { return gitError == GIT_OK; } -- (BOOL)performCheckout:(GTObject *)target withStrategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags error:(NSError **)error progressBlock:(GTCheckoutProgressBlock)progressBlock notifyBlock:(GTCheckoutNotifyBlock)notifyBlock { - - git_checkout_options checkoutOptions = GIT_CHECKOUT_OPTIONS_INIT; - - checkoutOptions.checkout_strategy = strategy; - checkoutOptions.progress_cb = checkoutProgressCallback; - checkoutOptions.progress_payload = (__bridge void *)progressBlock; - - checkoutOptions.notify_cb = checkoutNotifyCallback; - checkoutOptions.notify_flags = notifyFlags; - checkoutOptions.notify_payload = (__bridge void *)notifyBlock; - - int gitError = git_checkout_tree(self.git_repository, target.git_object, &checkoutOptions); +- (BOOL)performCheckout:(GTObject *)target options:(nullable GTCheckoutOptions *)options error:(NSError **)error { + int gitError = git_checkout_tree(self.git_repository, target.git_object, options.git_checkoutOptions); if (gitError < GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to checkout tree."]; } - return gitError == GIT_OK; } -- (BOOL)checkoutCommit:(GTCommit *)targetCommit strategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags error:(NSError **)error progressBlock:(GTCheckoutProgressBlock)progressBlock notifyBlock:(GTCheckoutNotifyBlock)notifyBlock { - BOOL success = [self performCheckout:targetCommit withStrategy:strategy notifyFlags:notifyFlags error:error progressBlock:progressBlock notifyBlock:notifyBlock]; +- (BOOL)checkoutCommit:(GTCommit *)targetCommit options:(GTCheckoutOptions *)options error:(NSError **)error { + BOOL success = [self performCheckout:targetCommit options:options error:error]; if (success == NO) return NO; return [self moveHEADToCommit:targetCommit error:error]; } -- (BOOL)checkoutReference:(GTReference *)targetReference strategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags error:(NSError **)error progressBlock:(GTCheckoutProgressBlock)progressBlock notifyBlock:(GTCheckoutNotifyBlock)notifyBlock { +- (BOOL)checkoutReference:(GTReference *)targetReference options:(GTCheckoutOptions *)options error:(NSError **)error { GTOID *targetOID = [targetReference targetOID]; GTObject *target = [self lookUpObjectByOID:targetOID error:error]; if (target == nil) return NO; - BOOL success = [self performCheckout:target withStrategy:strategy notifyFlags:notifyFlags error:error progressBlock:progressBlock notifyBlock:notifyBlock]; + BOOL success = [self performCheckout:target options:options error:error]; if (success == NO) return NO; return [self moveHEADToReference:targetReference error:error]; } -- (BOOL)checkoutCommit:(GTCommit *)target strategy:(GTCheckoutStrategyType)strategy error:(NSError **)error progressBlock:(GTCheckoutProgressBlock)progressBlock { - return [self checkoutCommit:target strategy:strategy notifyFlags:GTCheckoutNotifyNone error:error progressBlock:progressBlock notifyBlock:nil]; -} - -- (BOOL)checkoutReference:(GTReference *)target strategy:(GTCheckoutStrategyType)strategy error:(NSError **)error progressBlock:(GTCheckoutProgressBlock)progressBlock { - return [self checkoutReference:target strategy:strategy notifyFlags:GTCheckoutNotifyNone error:error progressBlock:progressBlock notifyBlock:nil]; -} - - (void)flushAttributesCache { git_attr_cache_flush(self.git_repository); } diff --git a/ObjectiveGit/ObjectiveGit.h b/ObjectiveGit/ObjectiveGit.h index 4efa0e81f..5c8cba5bc 100644 --- a/ObjectiveGit/ObjectiveGit.h +++ b/ObjectiveGit/ObjectiveGit.h @@ -71,6 +71,7 @@ FOUNDATION_EXPORT const unsigned char ObjectiveGitVersionString[]; #import #import #import +#import #import #import diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index fb2b0912d..2f241ff67 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -94,6 +94,10 @@ 4D79C0EE17DF9F4D00997DE4 /* GTCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D79C0EC17DF9F4D00997DE4 /* GTCredential.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4D79C0EF17DF9F4D00997DE4 /* GTCredential.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D79C0ED17DF9F4D00997DE4 /* GTCredential.m */; }; 4DBA4A3217DA73CE006CD5F5 /* GTRemoteSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DBA4A3117DA73CE006CD5F5 /* GTRemoteSpec.m */; }; + 4DC55AE51AD859AD0032563C /* GTCheckoutOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4DC55AE61AD859AD0032563C /* GTCheckoutOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4DC55AE71AD859AD0032563C /* GTCheckoutOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */; }; + 4DC55AE81AD859AD0032563C /* GTCheckoutOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */; }; 4DFFB15B183AA8D600D1565E /* GTRepository+RemoteOperations.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DFFB159183AA8D600D1565E /* GTRepository+RemoteOperations.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4DFFB15C183AA8D600D1565E /* GTRepository+RemoteOperations.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DFFB15A183AA8D600D1565E /* GTRepository+RemoteOperations.m */; }; 55C8055013861FE7004DCB0F /* GTObjectDatabase.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C8054D13861F34004DCB0F /* GTObjectDatabase.m */; }; @@ -487,6 +491,8 @@ 4D79C0ED17DF9F4D00997DE4 /* GTCredential.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTCredential.m; sourceTree = ""; }; 4D79C0F617DFAA7100997DE4 /* GTCredential+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTCredential+Private.h"; sourceTree = ""; }; 4DBA4A3117DA73CE006CD5F5 /* GTRemoteSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTRemoteSpec.m; sourceTree = ""; }; + 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTCheckoutOptions.h; sourceTree = ""; }; + 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTCheckoutOptions.m; sourceTree = ""; }; 4DE864341794A37E00371A65 /* GTRepository+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTRepository+Private.h"; sourceTree = ""; }; 4DFFB159183AA8D600D1565E /* GTRepository+RemoteOperations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTRepository+RemoteOperations.h"; sourceTree = ""; }; 4DFFB15A183AA8D600D1565E /* GTRepository+RemoteOperations.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+RemoteOperations.m"; sourceTree = ""; }; @@ -959,6 +965,8 @@ 88E352FF1982E9160051001F /* GTRepository+Attributes.m */, 6EEB519F199D62B9001D72C0 /* GTFetchHeadEntry.h */, 6EEB51A0199D62B9001D72C0 /* GTFetchHeadEntry.m */, + 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */, + 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */, ); path = ObjectiveGit; sourceTree = ""; @@ -1077,6 +1085,7 @@ BDFAF9C3131C1845000508BC /* GTIndex.h in Headers */, BDFAF9C9131C1868000508BC /* GTIndexEntry.h in Headers */, 6EEB51A1199D62B9001D72C0 /* GTFetchHeadEntry.h in Headers */, + 4DC55AE51AD859AD0032563C /* GTCheckoutOptions.h in Headers */, BD441E08131ED0C300187010 /* GTReference.h in Headers */, 88F6D9D91320451F00CC0BA8 /* ObjectiveGit.h in Headers */, 88B2131C1B20E785005CF2C5 /* GTRepository+References.h in Headers */, @@ -1160,6 +1169,7 @@ D01B6F5919F82FA600D411BC /* GTOID.h in Headers */, D01B6F6D19F82FB300D411BC /* GTDiffFile.h in Headers */, D01B6F2F19F82F8700D411BC /* GTObject.h in Headers */, + 4DC55AE61AD859AD0032563C /* GTCheckoutOptions.h in Headers */, D01B6F4B19F82F8700D411BC /* GTConfiguration.h in Headers */, D01B6F6719F82FA600D411BC /* GTFetchHeadEntry.h in Headers */, D01B6F5F19F82FA600D411BC /* GTFilter.h in Headers */, @@ -1461,6 +1471,7 @@ 23F39FAE1C86DB1C00849F3C /* GTRepository+Merging.m in Sources */, 30DCBA6517B45A78009B0EBD /* GTRepository+Status.m in Sources */, BD6C235413146E6A00992935 /* GTObject.m in Sources */, + 4DC55AE71AD859AD0032563C /* GTCheckoutOptions.m in Sources */, BD6C254613148DD300992935 /* GTSignature.m in Sources */, BD6B0412131496B8001909D0 /* GTTree.m in Sources */, BD6B0418131496CC001909D0 /* GTTreeEntry.m in Sources */, @@ -1522,6 +1533,7 @@ 23F39FB01C86E01800849F3C /* GTRepository+Merging.m in Sources */, D019778A19F8307600F523DA /* ObjectiveGit.m in Sources */, D01B6F3219F82F8700D411BC /* GTCommit.m in Sources */, + 4DC55AE81AD859AD0032563C /* GTCheckoutOptions.m in Sources */, D01B6F3819F82F8700D411BC /* GTTree.m in Sources */, D01B6F6C19F82FB300D411BC /* GTDiff.m in Sources */, 884C8A3A19FF4B890017E98D /* EXTScope.m in Sources */, diff --git a/ObjectiveGitTests/GTFilterSpec.m b/ObjectiveGitTests/GTFilterSpec.m index 2f969e731..318a514a2 100644 --- a/ObjectiveGitTests/GTFilterSpec.m +++ b/ObjectiveGitTests/GTFilterSpec.m @@ -159,7 +159,7 @@ BOOL success = [NSFileManager.defaultManager removeItemAtURL:testFileURL error:NULL]; expect(@(success)).to(beTruthy()); - success = [repository checkoutCommit:newCommit strategy:GTCheckoutStrategyForce error:NULL progressBlock:NULL]; + success = [repository checkoutCommit:newCommit options:[GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategyForce] error:NULL]; expect(@(success)).to(beTruthy()); expect([NSData dataWithContentsOfURL:testFileURL]).to(equal(replacementData)); diff --git a/ObjectiveGitTests/GTRepositorySpec.m b/ObjectiveGitTests/GTRepositorySpec.m index 8c7740dcc..1d570690b 100644 --- a/ObjectiveGitTests/GTRepositorySpec.m +++ b/ObjectiveGitTests/GTRepositorySpec.m @@ -416,7 +416,7 @@ GTReference *ref = [repository lookUpReferenceWithName:@"refs/heads/other-branch" error:&error]; expect(ref).notTo(beNil()); expect(error.localizedDescription).to(beNil()); - BOOL result = [repository checkoutReference:ref strategy:GTCheckoutStrategyAllowConflicts error:&error progressBlock:nil]; + BOOL result = [repository checkoutReference:ref options:[GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategyAllowConflicts] error:&error]; expect(@(result)).to(beTruthy()); expect(error.localizedDescription).to(beNil()); }); @@ -426,7 +426,7 @@ GTCommit *commit = [repository lookUpObjectBySHA:@"1d69f3c0aeaf0d62e25591987b93b8ffc53abd77" objectType:GTObjectTypeCommit error:&error]; expect(commit).notTo(beNil()); expect(error.localizedDescription).to(beNil()); - BOOL result = [repository checkoutCommit:commit strategy:GTCheckoutStrategyAllowConflicts error:&error progressBlock:nil]; + BOOL result = [repository checkoutCommit:commit options:[GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategyAllowConflicts] error:&error]; expect(@(result)).to(beTruthy()); expect(error.localizedDescription).to(beNil()); }); @@ -451,7 +451,8 @@ return 0; }; - BOOL result = [repository checkoutReference:ref strategy:GTCheckoutStrategySafe notifyFlags:GTCheckoutNotifyConflict error:&error progressBlock:nil notifyBlock:notifyBlock]; + GTCheckoutOptions *options = [GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategySafe notifyFlags:GTCheckoutNotifyConflict notifyBlock:notifyBlock]; + BOOL result = [repository checkoutReference:ref options:options error:&error]; expect(@(notifyCount)).to(equal(@(1))); expect(@(readmeFileConflicted)).to(beTruthy()); expect(@(result)).to(beFalsy()); @@ -476,7 +477,9 @@ return 0; }; - BOOL result = [repository checkoutCommit:commit strategy:GTCheckoutStrategySafe notifyFlags:GTCheckoutNotifyConflict error:&error progressBlock:nil notifyBlock:notifyBlock]; + + GTCheckoutOptions *options = [GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategySafe notifyFlags:GTCheckoutNotifyConflict notifyBlock:notifyBlock]; + BOOL result = [repository checkoutCommit:commit options:options error:&error]; expect(@(notifyCount)).to(equal(@(1))); expect(@(readme1FileConflicted)).to(beTruthy()); expect(@(result)).to(beFalsy()); diff --git a/ObjectiveGitTests/GTSubmoduleSpec.m b/ObjectiveGitTests/GTSubmoduleSpec.m index 1039703ac..d246b1507 100644 --- a/ObjectiveGitTests/GTSubmoduleSpec.m +++ b/ObjectiveGitTests/GTSubmoduleSpec.m @@ -86,7 +86,7 @@ expect(submoduleRepository).notTo(beNil()); GTCommit *commit = [submoduleRepository lookUpObjectByRevParse:@"HEAD^" error:NULL]; - BOOL success = [submoduleRepository checkoutCommit:commit strategy:GTCheckoutStrategyForce error:NULL progressBlock:nil]; + BOOL success = [submoduleRepository checkoutCommit:commit options:[GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategyForce] error:NULL]; expect(@(success)).to(beTruthy()); success = [submodule addToIndex:NULL]; From 3cb36a8c7d5e6bcdf8c4bbbde05fba77742d8714 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Tue, 8 Sep 2015 22:59:09 +0200 Subject: [PATCH 114/228] 0xdeadbeef --- ObjectiveGit/GTRepository.m | 2 -- 1 file changed, 2 deletions(-) diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 0cf4399ce..ecffb1541 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -322,8 +322,6 @@ + (nullable instancetype)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSU } return [[self alloc] initWithGitRepository:repository]; - - return nil; } - (id)lookUpObjectByGitOid:(const git_oid *)oid objectType:(GTObjectType)type error:(NSError **)error { From f66d71376cb68d6a56fc7c36d2e82b93f3f29252 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Tue, 8 Sep 2015 23:11:23 +0200 Subject: [PATCH 115/228] Missing documentation for parameter --- ObjectiveGit/GTRepository+Stashing.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ObjectiveGit/GTRepository+Stashing.h b/ObjectiveGit/GTRepository+Stashing.h index 97f3e6474..aea37fa3f 100644 --- a/ObjectiveGit/GTRepository+Stashing.h +++ b/ObjectiveGit/GTRepository+Stashing.h @@ -64,18 +64,20 @@ NS_ASSUME_NONNULL_BEGIN /// Apply stashed changes. /// -/// index - The index of the stash to apply. 0 is the latest one. -/// flags - The flags to use when applying the stash. -/// error - If not NULL, set to any error that occurred. +/// index - The index of the stash to apply. 0 is the latest one. +/// flags - The flags to use when applying the stash. +/// error - If not NULL, set to any error that occurred. +/// progressBlock - A block that will be executed on each step of the stash application. /// /// Returns YES if the requested stash was successfully applied, NO otherwise. - (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock; /// Pop stashed changes. /// -/// index - The index of the stash to apply. 0 is the most recent stash. -/// flags - The flags to use when applying the stash. -/// error - If not NULL, set to any error that occurred. +/// index - The index of the stash to apply. 0 is the most recent stash. +/// flags - The flags to use when applying the stash. +/// error - If not NULL, set to any error that occurred. +/// progressBlock - A block that will be executed on each step of the stash application. /// /// Returns YES if the requested stash was successfully applied, NO otherwise. - (BOOL)popStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock; From 84fd119f07eadbe996309cc627ae6af1bcfccbed Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Tue, 8 Sep 2015 23:12:06 +0200 Subject: [PATCH 116/228] Add checkout options support to stash API. --- ObjectiveGit/GTRepository+Stashing.h | 6 ++++-- ObjectiveGit/GTRepository+Stashing.m | 12 ++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ObjectiveGit/GTRepository+Stashing.h b/ObjectiveGit/GTRepository+Stashing.h index aea37fa3f..10f3e3773 100644 --- a/ObjectiveGit/GTRepository+Stashing.h +++ b/ObjectiveGit/GTRepository+Stashing.h @@ -66,21 +66,23 @@ NS_ASSUME_NONNULL_BEGIN /// /// index - The index of the stash to apply. 0 is the latest one. /// flags - The flags to use when applying the stash. +/// options - The options to use when checking out. /// error - If not NULL, set to any error that occurred. /// progressBlock - A block that will be executed on each step of the stash application. /// /// Returns YES if the requested stash was successfully applied, NO otherwise. -- (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock; +- (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags checkoutOptions:(nullable GTCheckoutOptions *)options error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock; /// Pop stashed changes. /// /// index - The index of the stash to apply. 0 is the most recent stash. /// flags - The flags to use when applying the stash. +/// options - The options to use when checking out. /// error - If not NULL, set to any error that occurred. /// progressBlock - A block that will be executed on each step of the stash application. /// /// Returns YES if the requested stash was successfully applied, NO otherwise. -- (BOOL)popStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock; +- (BOOL)popStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags checkoutOptions:(nullable GTCheckoutOptions *)options error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock; /// Drop a stash from the repository's list of stashes. /// diff --git a/ObjectiveGit/GTRepository+Stashing.m b/ObjectiveGit/GTRepository+Stashing.m index 3f870130a..10a95c8fd 100644 --- a/ObjectiveGit/GTRepository+Stashing.m +++ b/ObjectiveGit/GTRepository+Stashing.m @@ -59,7 +59,7 @@ static int stashApplyProgressCallback(git_stash_apply_progress_t progress, void return (stop ? GIT_EUSER : 0); } -- (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock { +- (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags checkoutOptions:(GTCheckoutOptions *)options error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock { git_stash_apply_options stash_options = GIT_STASH_APPLY_OPTIONS_INIT; stash_options.flags = (git_stash_apply_flags)flags; @@ -68,6 +68,10 @@ - (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)fl stash_options.progress_payload = (__bridge void *)progressBlock; } + if (options != nil) { + stash_options.checkout_options = *options.git_checkoutOptions; + } + int gitError = git_stash_apply(self.git_repository, index, &stash_options); if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Stash apply failed" failureReason:@"The stash at index %ld couldn't be applied.", (unsigned long)index]; @@ -76,7 +80,7 @@ - (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)fl return YES; } -- (BOOL)popStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock { +- (BOOL)popStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags checkoutOptions:(GTCheckoutOptions *)options error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock{ git_stash_apply_options stash_options = GIT_STASH_APPLY_OPTIONS_INIT; stash_options.flags = (git_stash_apply_flags)flags; @@ -85,6 +89,10 @@ - (BOOL)popStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flag stash_options.progress_payload = (__bridge void *)progressBlock; } + if (options != nil) { + stash_options.checkout_options = *options.git_checkoutOptions; + } + int gitError = git_stash_pop(self.git_repository, index, &stash_options); if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Stash pop failed" failureReason:@"The stash at index %ld couldn't be applied.", (unsigned long)index]; From dea950760606b75bc8eaa4577d8be9f20ce625de Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Thu, 10 Sep 2015 01:05:15 +0200 Subject: [PATCH 117/228] Fix stash tests --- ObjectiveGitTests/GTRepositoryStashingSpec.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ObjectiveGitTests/GTRepositoryStashingSpec.m b/ObjectiveGitTests/GTRepositoryStashingSpec.m index 6f7a2d090..75a51a328 100644 --- a/ObjectiveGitTests/GTRepositoryStashingSpec.m +++ b/ObjectiveGitTests/GTRepositoryStashingSpec.m @@ -129,7 +129,7 @@ expect(error).to(beNil()); __block BOOL progressCalled = NO; - BOOL success = [repository applyStashAtIndex:0 flags:GTRepositoryStashApplyFlagDefault error:&error progressBlock:^void(GTRepositoryStashApplyProgress step, BOOL *stop) { + BOOL success = [repository applyStashAtIndex:0 flags:GTRepositoryStashApplyFlagDefault checkoutOptions:nil error:&error progressBlock:^void(GTRepositoryStashApplyProgress step, BOOL *stop) { progressCalled = YES; }]; expect(@(success)).to(beTruthy()); @@ -162,7 +162,7 @@ lastStashIndex = index; }]; - success = [repository applyStashAtIndex:(lastStashIndex + 1) flags:GTRepositoryStashApplyFlagDefault error:&error progressBlock:nil]; + success = [repository applyStashAtIndex:(lastStashIndex + 1) flags:GTRepositoryStashApplyFlagDefault checkoutOptions:nil error:&error progressBlock:nil]; expect(@(success)).to(beFalsy()); expect(error).notTo(beNil()); expect(error.domain).to(equal(GTGitErrorDomain)); @@ -186,7 +186,7 @@ expect(@([@"barfoo" writeToURL:[repository.fileURL URLByAppendingPathComponent:@"new-test-file"] atomically:YES encoding:NSUTF8StringEncoding error:NULL])).to(beTruthy()); - BOOL success = [repository applyStashAtIndex:0 flags:GTRepositoryStashApplyFlagDefault error:&error progressBlock:nil]; + BOOL success = [repository applyStashAtIndex:0 flags:GTRepositoryStashApplyFlagDefault checkoutOptions:nil error:&error progressBlock:nil]; expect(@(success)).to(beFalsy()); expect(error).notTo(beNil()); From e03bee9cc2b641b81a945450d0aff8c11e2a7e4d Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Thu, 10 Sep 2015 23:02:33 +0200 Subject: [PATCH 118/228] Switch to the modern object-wrap syntax --- ObjectiveGit/GTCheckoutOptions.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTCheckoutOptions.m b/ObjectiveGit/GTCheckoutOptions.m index a20462992..d83b2ef6f 100644 --- a/ObjectiveGit/GTCheckoutOptions.m +++ b/ObjectiveGit/GTCheckoutOptions.m @@ -63,7 +63,7 @@ - (instancetype)init { static void GTCheckoutProgressCallback(const char *path, size_t completedSteps, size_t totalSteps, void *payload) { if (payload == NULL) return; void (^block)(NSString *, NSUInteger, NSUInteger) = (__bridge id)payload; - NSString *nsPath = (path != NULL ? [NSString stringWithUTF8String:path] : nil); + NSString *nsPath = (path != NULL ? @(path) : nil); block(nsPath, completedSteps, totalSteps); } From af073575a9283123fc2022fa65f192e6f29e397d Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Thu, 10 Sep 2015 23:02:50 +0200 Subject: [PATCH 119/228] Explicit comparison with `nil` --- ObjectiveGit/GTCheckoutOptions.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ObjectiveGit/GTCheckoutOptions.m b/ObjectiveGit/GTCheckoutOptions.m index d83b2ef6f..8106a579f 100644 --- a/ObjectiveGit/GTCheckoutOptions.m +++ b/ObjectiveGit/GTCheckoutOptions.m @@ -80,12 +80,12 @@ static int GTCheckoutNotifyCallback(git_checkout_notify_t why, const char *path, - (git_checkout_options *)git_checkoutOptions { _git_checkoutOptions.checkout_strategy = self.strategy; - if (self.progressBlock) { + if (self.progressBlock != nil) { _git_checkoutOptions.progress_cb = GTCheckoutProgressCallback; _git_checkoutOptions.progress_payload = (__bridge void *)self.progressBlock; } - if (self.notifyBlock) { + if (self.notifyBlock != nil) { _git_checkoutOptions.notify_cb = GTCheckoutNotifyCallback; _git_checkoutOptions.notify_flags = self.notifyFlags; _git_checkoutOptions.notify_payload = (__bridge void *)self.notifyBlock; From 7e6719f2e6d8a7d465f82f612910f1baf494cae8 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Tue, 31 May 2016 18:42:31 +0200 Subject: [PATCH 120/228] Add pathspec support to GTCheckoutOptions --- ObjectiveGit/GTCheckoutOptions.h | 3 +++ ObjectiveGit/GTCheckoutOptions.m | 3 +++ 2 files changed, 6 insertions(+) diff --git a/ObjectiveGit/GTCheckoutOptions.h b/ObjectiveGit/GTCheckoutOptions.h index 6ab8f6b3d..3c63855a0 100644 --- a/ObjectiveGit/GTCheckoutOptions.h +++ b/ObjectiveGit/GTCheckoutOptions.h @@ -58,6 +58,9 @@ typedef NS_OPTIONS(NSInteger, GTCheckoutNotifyFlags) { @property (assign) GTCheckoutNotifyFlags notifyFlags; @property (copy) int (^notifyBlock)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir); + +@property (copy) NSArray *pathSpecs; + @end NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/ObjectiveGit/GTCheckoutOptions.m b/ObjectiveGit/GTCheckoutOptions.m index 8106a579f..f4c18ed5e 100644 --- a/ObjectiveGit/GTCheckoutOptions.m +++ b/ObjectiveGit/GTCheckoutOptions.m @@ -9,6 +9,7 @@ #import "GTCheckoutOptions.h" #import "GTDiffFile.h" #import "NSError+Git.h" +#import "NSArray+StringArray.h" #import "git2.h" // The type of block set in progressBlock for progress reporting @@ -91,6 +92,8 @@ - (git_checkout_options *)git_checkoutOptions { _git_checkoutOptions.notify_payload = (__bridge void *)self.notifyBlock; } + _git_checkoutOptions.paths = self.pathSpecs.git_strarray; + return &_git_checkoutOptions; } From a5ed471422b825acd69d57154d425dcd066f6678 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Tue, 28 Jun 2016 09:58:21 +0200 Subject: [PATCH 121/228] Fix a newly added checkout strategy call --- ObjectiveGit/GTRepository+Merging.m | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ObjectiveGit/GTRepository+Merging.m b/ObjectiveGit/GTRepository+Merging.m index bb0c1fbb5..958f53ec6 100644 --- a/ObjectiveGit/GTRepository+Merging.m +++ b/ObjectiveGit/GTRepository+Merging.m @@ -107,8 +107,7 @@ - (BOOL)mergeBranchIntoCurrentBranch:(GTBranch *)branch withError:(NSError **)er // Fast-forward branch NSString *message = [NSString stringWithFormat:@"merge %@: Fast-forward", branch.name]; GTReference *reference = [localBranch.reference referenceByUpdatingTarget:remoteCommit.SHA message:message error:error]; - BOOL checkoutSuccess = [self checkoutReference:reference strategy:GTCheckoutStrategyForce error:error progressBlock:nil]; - + BOOL checkoutSuccess = [self checkoutReference:reference options:[GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategyForce] error:error]; return checkoutSuccess; } else if (analysis & GTMergeAnalysisNormal) { // Do normal merge @@ -164,7 +163,7 @@ - (BOOL)mergeBranchIntoCurrentBranch:(GTBranch *)branch withError:(NSError **)er return NO; } - BOOL success = [self checkoutReference:localBranch.reference strategy:GTCheckoutStrategyForce error:error progressBlock:nil]; + BOOL success = [self checkoutReference:localBranch.reference options:[GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategyForce] error:error]; return success; } From 8841ce79cc36851d636b1669eafe92955bdc5883 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 11 Jul 2016 20:12:56 +0200 Subject: [PATCH 122/228] Remove deprecated method on GTRepository --- ObjectiveGit/GTRepository.h | 3 -- ObjectiveGit/GTRepository.m | 19 ------------- ObjectiveGitTests/GTRemotePushSpec.m | 4 +-- ObjectiveGitTests/GTRemoteSpec.m | 2 +- ObjectiveGitTests/GTRepository+PullSpec.m | 4 +-- ObjectiveGitTests/GTRepositorySpec.m | 34 +++++++++++++++++++---- 6 files changed, 34 insertions(+), 32 deletions(-) diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index bdf9a8ca8..3cfe963f6 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -242,9 +242,6 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// returns nil (and fills the error parameter) if an error occurred, or a GTRepository object if successful. + (nullable instancetype)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(nullable NSDictionary *)options error:(NSError **)error transferProgressBlock:(nullable void (^)(const git_transfer_progress *, BOOL *stop))transferProgressBlock; -/// Backward-compatible method that uses `GTRepositoryCloneOptionsCheckout` -+ (nullable instancetype)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(nullable NSDictionary *)options error:(NSError **)error transferProgressBlock:(nullable void (^)(const git_transfer_progress *, BOOL *stop))transferProgressBlock checkoutProgressBlock:(nullable void (^) (NSString *__nullable path, NSUInteger completedSteps, NSUInteger totalSteps))checkoutProgressBlock; - /// Lookup objects in the repo by oid or sha1 - (nullable id)lookUpObjectByOID:(GTOID *)oid objectType:(GTObjectType)type error:(NSError **)error; - (nullable id)lookUpObjectByOID:(GTOID *)oid error:(NSError **)error; diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index ecffb1541..4d9ea46a2 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -242,25 +242,6 @@ static int remoteCreate(git_remote **remote, git_repository *repo, const char *n git_remote_callbacks remoteCallbacks; }; -// Backward-compatibility with GTRepositoryCloneOptionsCheckout boolean -+ (nullable instancetype)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(nullable NSDictionary *)options error:(NSError **)error transferProgressBlock:(nullable void (^)(const git_transfer_progress *, BOOL *stop))transferProgressBlock checkoutProgressBlock:(nullable void (^)(NSString *__nullable path, NSUInteger completedSteps, NSUInteger totalSteps))checkoutProgressBlock { - NSNumber *checkout = options[GTRepositoryCloneOptionsCheckout]; - BOOL doCheckout = (checkout == nil ? YES : [checkout boolValue]); - if (doCheckout) { - GTCheckoutOptions *checkoutOptions = nil; - if (checkoutProgressBlock) { - checkoutOptions = [GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategySafe progressBlock:checkoutProgressBlock]; - } else { - checkoutOptions = [GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategySafe]; - } - - NSMutableDictionary *mutableOptions = [options mutableCopy]; - mutableOptions[GTRepositoryCloneCheckoutOptions] = checkoutOptions; - options = mutableOptions; - } - return [self cloneFromURL:originURL toWorkingDirectory:workdirURL options:options error:error transferProgressBlock:transferProgressBlock]; -} - + (nullable instancetype)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(nullable NSDictionary *)options error:(NSError **)error transferProgressBlock:(nullable void (^)(const git_transfer_progress *, BOOL *stop))transferProgressBlock { git_clone_options cloneOptions = GIT_CLONE_OPTIONS_INIT; diff --git a/ObjectiveGitTests/GTRemotePushSpec.m b/ObjectiveGitTests/GTRemotePushSpec.m index 050cb10aa..4c14f946a 100644 --- a/ObjectiveGitTests/GTRemotePushSpec.m +++ b/ObjectiveGitTests/GTRemotePushSpec.m @@ -39,7 +39,7 @@ // Make a bare clone to serve as the remote remoteRepoURL = [notBareRepo.gitDirectoryURL.URLByDeletingLastPathComponent URLByAppendingPathComponent:@"bare_remote_repo.git"]; NSDictionary *options = @{ GTRepositoryCloneOptionsBare: @1 }; - remoteRepo = [GTRepository cloneFromURL:notBareRepo.gitDirectoryURL toWorkingDirectory:remoteRepoURL options:options error:&error transferProgressBlock:NULL checkoutProgressBlock:NULL]; + remoteRepo = [GTRepository cloneFromURL:notBareRepo.gitDirectoryURL toWorkingDirectory:remoteRepoURL options:options error:&error transferProgressBlock:NULL]; expect(error).to(beNil()); expect(remoteRepo).notTo(beNil()); expect(@(remoteRepo.isBare)).to(beTruthy()); // that's better @@ -48,7 +48,7 @@ expect(localRepoURL).notTo(beNil()); // Local clone for testing pushes - localRepo = [GTRepository cloneFromURL:remoteRepoURL toWorkingDirectory:localRepoURL options:nil error:&error transferProgressBlock:NULL checkoutProgressBlock:NULL]; + localRepo = [GTRepository cloneFromURL:remoteRepoURL toWorkingDirectory:localRepoURL options:nil error:&error transferProgressBlock:NULL]; expect(error).to(beNil()); expect(localRepo).notTo(beNil()); diff --git a/ObjectiveGitTests/GTRemoteSpec.m b/ObjectiveGitTests/GTRemoteSpec.m index 35a098edc..5f8449ca8 100644 --- a/ObjectiveGitTests/GTRemoteSpec.m +++ b/ObjectiveGitTests/GTRemoteSpec.m @@ -107,7 +107,7 @@ fetchingRepoURL = [fixturesURL URLByAppendingPathComponent:@"fetchrepo"]; NSError *error = nil; - fetchingRepo = [GTRepository cloneFromURL:repositoryURL toWorkingDirectory:fetchingRepoURL options:nil error:&error transferProgressBlock:nil checkoutProgressBlock:nil]; + fetchingRepo = [GTRepository cloneFromURL:repositoryURL toWorkingDirectory:fetchingRepoURL options:nil error:&error transferProgressBlock:nil]; expect(fetchingRepo).notTo(beNil()); expect(error).to(beNil()); diff --git a/ObjectiveGitTests/GTRepository+PullSpec.m b/ObjectiveGitTests/GTRepository+PullSpec.m index ef0999566..bb157454d 100644 --- a/ObjectiveGitTests/GTRepository+PullSpec.m +++ b/ObjectiveGitTests/GTRepository+PullSpec.m @@ -40,7 +40,7 @@ // Make a bare clone to serve as the remote remoteRepoURL = [notBareRepo.gitDirectoryURL.URLByDeletingLastPathComponent URLByAppendingPathComponent:@"bare_remote_repo.git"]; NSDictionary *options = @{ GTRepositoryCloneOptionsBare: @1 }; - remoteRepo = [GTRepository cloneFromURL:notBareRepo.gitDirectoryURL toWorkingDirectory:remoteRepoURL options:options error:&error transferProgressBlock:NULL checkoutProgressBlock:NULL]; + remoteRepo = [GTRepository cloneFromURL:notBareRepo.gitDirectoryURL toWorkingDirectory:remoteRepoURL options:options error:&error transferProgressBlock:NULL]; expect(error).to(beNil()); expect(remoteRepo).notTo(beNil()); expect(@(remoteRepo.isBare)).to(beTruthy()); // that's better @@ -49,7 +49,7 @@ expect(localRepoURL).notTo(beNil()); // Local clone for testing pushes - localRepo = [GTRepository cloneFromURL:remoteRepoURL toWorkingDirectory:localRepoURL options:nil error:&error transferProgressBlock:NULL checkoutProgressBlock:NULL]; + localRepo = [GTRepository cloneFromURL:remoteRepoURL toWorkingDirectory:localRepoURL options:nil error:&error transferProgressBlock:NULL]; expect(error).to(beNil()); expect(localRepo).notTo(beNil()); diff --git a/ObjectiveGitTests/GTRepositorySpec.m b/ObjectiveGitTests/GTRepositorySpec.m index 1d570690b..24fac195f 100644 --- a/ObjectiveGitTests/GTRepositorySpec.m +++ b/ObjectiveGitTests/GTRepositorySpec.m @@ -95,7 +95,14 @@ it(@"should handle normal clones", ^{ NSError *error = nil; - repository = [GTRepository cloneFromURL:originURL toWorkingDirectory:workdirURL options:@{ GTRepositoryCloneOptionsCloneLocal: @YES } error:&error transferProgressBlock:transferProgressBlock checkoutProgressBlock:checkoutProgressBlock]; + GTCheckoutOptions *checkoutOptions = [GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategySafe]; + checkoutOptions.progressBlock = checkoutProgressBlock; + + NSDictionary *cloneOptions = @{ + GTRepositoryCloneOptionsCloneLocal: @YES, + GTRepositoryCloneCheckoutOptions: checkoutOptions, + }; + repository = [GTRepository cloneFromURL:originURL toWorkingDirectory:workdirURL options:cloneOptions error:&error transferProgressBlock:transferProgressBlock]; expect(repository).notTo(beNil()); expect(error).to(beNil()); expect(@(transferProgressCalled)).to(beTruthy()); @@ -112,8 +119,15 @@ it(@"should handle bare clones", ^{ NSError *error = nil; - NSDictionary *options = @{ GTRepositoryCloneOptionsBare: @YES, GTRepositoryCloneOptionsCloneLocal: @YES }; - repository = [GTRepository cloneFromURL:originURL toWorkingDirectory:workdirURL options:options error:&error transferProgressBlock:transferProgressBlock checkoutProgressBlock:checkoutProgressBlock]; + GTCheckoutOptions *checkoutOptions = [GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategySafe]; + checkoutOptions.progressBlock = checkoutProgressBlock; + + NSDictionary *options = @{ + GTRepositoryCloneOptionsBare: @YES, + GTRepositoryCloneOptionsCloneLocal: @YES, + GTRepositoryCloneCheckoutOptions: checkoutOptions, + }; + repository = [GTRepository cloneFromURL:originURL toWorkingDirectory:workdirURL options:options error:&error transferProgressBlock:transferProgressBlock]; expect(repository).notTo(beNil()); expect(error).to(beNil()); expect(@(transferProgressCalled)).to(beTruthy()); @@ -130,7 +144,10 @@ it(@"should have set a valid remote URL", ^{ NSError *error = nil; - repository = [GTRepository cloneFromURL:originURL toWorkingDirectory:workdirURL options:nil error:&error transferProgressBlock:transferProgressBlock checkoutProgressBlock:checkoutProgressBlock]; + GTCheckoutOptions *checkoutOptions = [GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategySafe]; + checkoutOptions.progressBlock = checkoutProgressBlock; + + repository = [GTRepository cloneFromURL:originURL toWorkingDirectory:workdirURL options:@{ GTRepositoryCloneCheckoutOptions: checkoutOptions } error:&error transferProgressBlock:transferProgressBlock]; expect(repository).notTo(beNil()); expect(error).to(beNil()); @@ -167,7 +184,14 @@ return cred; }]; - repository = [GTRepository cloneFromURL:originURL toWorkingDirectory:workdirURL options:@{GTRepositoryCloneOptionsCredentialProvider: provider} error:&error transferProgressBlock:transferProgressBlock checkoutProgressBlock:checkoutProgressBlock]; + GTCheckoutOptions *checkoutOptions = [GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategySafe]; + checkoutOptions.progressBlock = checkoutProgressBlock; + NSDictionary *cloneOptions = @{ + GTRepositoryCloneOptionsCredentialProvider: provider, + GTRepositoryCloneCheckoutOptions: checkoutOptions, + }; + + repository = [GTRepository cloneFromURL:originURL toWorkingDirectory:workdirURL options:cloneOptions error:&error transferProgressBlock:transferProgressBlock]; expect(repository).notTo(beNil()); expect(error).to(beNil()); expect(@(transferProgressCalled)).to(beTruthy()); From 9d131a346fa15da0e0127dd5485feb31dd4d3b6c Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Sat, 28 May 2016 15:13:04 +0200 Subject: [PATCH 123/228] Ability to checkout from an index --- ObjectiveGit/GTRepository.h | 9 +++++++++ ObjectiveGit/GTRepository.m | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index 3cfe963f6..e822b2548 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -526,6 +526,15 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// Returns YES if operation was successful, NO otherwise - (BOOL)checkoutReference:(GTReference *)targetReference options:(nullable GTCheckoutOptions *)options error:(NSError **)error; +/// Checkout an index +/// +/// index - The index to checkout. Must not be nil. +/// options - The checkout options to use. Can be nil. +/// error - The error if one occurred. Can be NULL. +/// +/// Returns YES if operation was successful, NO otherwise +- (BOOL)checkoutIndex:(GTIndex *)index options:(nullable GTCheckoutOptions *)options error:(NSError **)error; + /// Flush the gitattributes cache. - (void)flushAttributesCache; diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 4d9ea46a2..225f1c947 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -831,6 +831,15 @@ - (BOOL)checkoutReference:(GTReference *)targetReference options:(GTCheckoutOpti return [self moveHEADToReference:targetReference error:error]; } +- (BOOL)checkoutIndex:(GTIndex *)index options:(GTCheckoutOptions *)options error:(NSError **)error { + int gitError = git_checkout_index(self.git_repository, index.git_index, options.git_checkoutOptions); + if (gitError < GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to checkout index."]; + return NO; + } + return YES; +} + - (void)flushAttributesCache { git_attr_cache_flush(self.git_repository); } From 24fb88d198f3910d9487090f020889bc34f45e7f Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Tue, 6 Sep 2016 22:33:34 +0200 Subject: [PATCH 124/228] Missing newline at EOF --- ObjectiveGit/GTCheckoutOptions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTCheckoutOptions.h b/ObjectiveGit/GTCheckoutOptions.h index 3c63855a0..a30222183 100644 --- a/ObjectiveGit/GTCheckoutOptions.h +++ b/ObjectiveGit/GTCheckoutOptions.h @@ -63,4 +63,4 @@ typedef NS_OPTIONS(NSInteger, GTCheckoutNotifyFlags) { @end -NS_ASSUME_NONNULL_END \ No newline at end of file +NS_ASSUME_NONNULL_END From 261d619a38363a4a8f24095e77a2d7ea08c8e30b Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Sun, 15 Jan 2017 14:54:44 +0100 Subject: [PATCH 125/228] Documentation --- ObjectiveGit/GTCheckoutOptions.h | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/ObjectiveGit/GTCheckoutOptions.h b/ObjectiveGit/GTCheckoutOptions.h index a30222183..1a3ab50e4 100644 --- a/ObjectiveGit/GTCheckoutOptions.h +++ b/ObjectiveGit/GTCheckoutOptions.h @@ -43,23 +43,51 @@ typedef NS_OPTIONS(NSInteger, GTCheckoutNotifyFlags) { }; @interface GTCheckoutOptions : NSObject + +/// Create a checkout options object. +/// +/// Since there are many places where we can checkout data, this object allow us +/// to centralize all the various behaviors that checkout allow. +/// +/// @param strategy The checkout strategy to use. +/// @param notifyFlags The checkout events that will be notified via `notifyBlock`. +/// @param progressBlock A block that will be called for each checkout step. +/// @param notifyBlock A block that will be called for each event, @see `notifyFlags`. +/// +/// @return A newly-initialized GTCheckoutOptions object. + (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags progressBlock:(nullable void (^)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps))progressBlock notifyBlock:(nullable int (^)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir))notifyBlock; +/// Create a checkout options object. +/// @see +checkoutOptionsWithStrategy:notifyFlags:progressBlock:notifyBlock: + (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags notifyBlock:(int (^)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir))notifyBlock; +/// Create a checkout options object. +/// @see +checkoutOptionsWithStrategy:notifyFlags:progressBlock:notifyBlock: + (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy progressBlock:(void (^)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps))progressBlock; +/// Create a checkout options object. +/// @see +checkoutOptionsWithStrategy:notifyFlags:progressBlock:notifyBlock: + (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy; +/// Get the underlying git_checkout_options struct. +/// +/// @return <#return value description#> - (git_checkout_options *)git_checkoutOptions NS_RETURNS_INNER_POINTER; +/// The checkout strategy to use. @property (assign) GTCheckoutStrategyType strategy; + +/// The checkout progress block that was passed in. @property (copy) 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) NSArray *pathSpecs; +/// An array of strings used to restrict what will be checked out. +@property (copy) NSArray *pathSpecs; @end From 4fe2e0357dd5984171e3745ada9adc37d8f1b216 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Sun, 15 Jan 2017 15:00:34 +0100 Subject: [PATCH 126/228] Add new checkout strategies --- ObjectiveGit/GTCheckoutOptions.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ObjectiveGit/GTCheckoutOptions.h b/ObjectiveGit/GTCheckoutOptions.h index 1a3ab50e4..ae3897e03 100644 --- a/ObjectiveGit/GTCheckoutOptions.h +++ b/ObjectiveGit/GTCheckoutOptions.h @@ -19,14 +19,23 @@ typedef NS_OPTIONS(NSInteger, GTCheckoutStrategyType) { GTCheckoutStrategyNone = GIT_CHECKOUT_NONE, GTCheckoutStrategySafe = GIT_CHECKOUT_SAFE, GTCheckoutStrategyForce = GIT_CHECKOUT_FORCE, + GTCheckoutStrategyRecreateMissing = GIT_CHECKOUT_RECREATE_MISSING, GTCheckoutStrategyAllowConflicts = GIT_CHECKOUT_ALLOW_CONFLICTS, GTCheckoutStrategyRemoveUntracked = GIT_CHECKOUT_REMOVE_UNTRACKED, GTCheckoutStrategyRemoveIgnored = GIT_CHECKOUT_REMOVE_IGNORED, GTCheckoutStrategyUpdateOnly = GIT_CHECKOUT_UPDATE_ONLY, GTCheckoutStrategyDontUpdateIndex = GIT_CHECKOUT_DONT_UPDATE_INDEX, GTCheckoutStrategyNoRefresh = GIT_CHECKOUT_NO_REFRESH, + GTCheckoutStrategySkipUnmerged = GIT_CHECKOUT_SKIP_UNMERGED, + GTCheckoutStrategyUseOurs = GIT_CHECKOUT_USE_OURS, + GTCheckoutStrategyUseTheirs = GIT_CHECKOUT_USE_THEIRS, GTCheckoutStrategyDisablePathspecMatch = GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH, GTCheckoutStrategySkipLockedDirectories = GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES, + GTCheckoutStrategyDoNotOverwriteIgnored = GIT_CHECKOUT_DONT_OVERWRITE_IGNORED, + GTCheckoutStrategyConflictStyleMerge = GIT_CHECKOUT_CONFLICT_STYLE_MERGE, + GTCheckoutStrategyCoflictStyleDiff3 = GIT_CHECKOUT_CONFLICT_STYLE_DIFF3, + GTCheckoutStrategyDoNotRemoveExisting = GIT_CHECKOUT_DONT_REMOVE_EXISTING, + GTCheckoutStrategyDoNotWriteIndex = GIT_CHECKOUT_DONT_WRITE_INDEX, }; /// Checkout notification flags used by the various -checkout... methods From 3c515b06f909a2a3ae8455adc28c616613b54696 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Sun, 15 Jan 2017 15:03:15 +0100 Subject: [PATCH 127/228] Options has gone away --- ObjectiveGit/GTRepository.m | 1 - 1 file changed, 1 deletion(-) diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 225f1c947..3d31f26d4 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -60,7 +60,6 @@ #import "git2.h" NSString * const GTRepositoryCloneOptionsBare = @"GTRepositoryCloneOptionsBare"; -NSString * const GTRepositoryCloneOptionsCheckout = @"GTRepositoryCloneOptionsCheckout"; NSString * const GTRepositoryCloneCheckoutOptions = @"GTRepositoryCloneCheckoutOptions"; NSString * const GTRepositoryCloneOptionsTransportFlags = @"GTRepositoryCloneOptionsTransportFlags"; NSString * const GTRepositoryCloneOptionsCredentialProvider = @"GTRepositoryCloneOptionsCredentialProvider"; From 46536f4b6be2638e8ffadfcd92368466bf2c5f81 Mon Sep 17 00:00:00 2001 From: Bob Sun Date: Fri, 17 Feb 2017 20:10:18 +0800 Subject: [PATCH 128/228] fix import typo which may introduce compilation error --- ObjectiveGit/GTRepository+References.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTRepository+References.h b/ObjectiveGit/GTRepository+References.h index 6809d9876..89ba93ca3 100644 --- a/ObjectiveGit/GTRepository+References.h +++ b/ObjectiveGit/GTRepository+References.h @@ -6,7 +6,7 @@ // Copyright (c) 2015 GitHub, Inc. All rights reserved. // -#import "GTrepository.h" +#import "GTRepository.h" NS_ASSUME_NONNULL_BEGIN From f09f1c6767db3b714ee0b53948353b9b021c02a1 Mon Sep 17 00:00:00 2001 From: Alexander Hedges Date: Sat, 18 Feb 2017 15:11:38 +0100 Subject: [PATCH 129/228] wrap git_remote_delete --- ObjectiveGit/GTRepository.h | 7 +++++++ ObjectiveGit/GTRepository.m | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index b98137207..9b1736474 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -357,6 +357,13 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// returns an array of NSStrings holding the names of the remotes, or nil if an error occurred - (nullable NSArray *)remoteNamesWithError:(NSError **)error; +/// Delete the given remote by name +/// +/// error - If not NULL, set to any error that occurs. +/// +/// returns YES if the deletion succeeded, otherwise NO. +- (BOOL)deleteRemoteNamed:(NSString *)remoteName error:(NSError **)error; + /// Get all tags in the repository. /// /// error - If not NULL, set to any error that occurs. diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 3a4976bc3..32918f111 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -466,6 +466,16 @@ - (NSArray *)remoteNamesWithError:(NSError **)error { return remoteNames; } +- (BOOL)deleteRemoteNamed:(NSString *)remoteName error:(NSError **)error { + int gitError = git_remote_delete(self.git_repository, [remoteName cStringUsingEncoding:NSUTF8StringEncoding]); + if (gitError < GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to delete remote."]; + return NO; + } + + return YES; +} + struct GTRepositoryTagEnumerationInfo { __unsafe_unretained GTRepository *myself; __unsafe_unretained GTRepositoryTagEnumerationBlock block; From daf7a6f2f10507c1f78c47de93665f8a6d0f44a7 Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Mon, 27 Feb 2017 13:24:42 +0300 Subject: [PATCH 130/228] Correct descriptions of applyStash: and popStash: --- ObjectiveGit/GTRepository+Stashing.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ObjectiveGit/GTRepository+Stashing.h b/ObjectiveGit/GTRepository+Stashing.h index 0c06cb24c..364d8a720 100644 --- a/ObjectiveGit/GTRepository+Stashing.h +++ b/ObjectiveGit/GTRepository+Stashing.h @@ -62,22 +62,22 @@ NS_ASSUME_NONNULL_BEGIN /// will cause enumeration to stop after the block returns. Must not be nil. - (void)enumerateStashesUsingBlock:(void (^)(NSUInteger index, NSString * __nullable message, GTOID * __nullable oid, BOOL *stop))block; -/// Apply stashed changes (with a default checkout strategy). +/// Apply stashed changes. /// /// index - The index of the stash to apply. 0 is the latest one. /// flags - The flags to use when applying the stash. -/// options - The options to use when checking out. +/// options - The options to use when checking out (if nil, use the defaults provided by libgit2). /// error - If not NULL, set to any error that occurred. /// progressBlock - A block that will be executed on each step of the stash application. /// /// Returns YES if the requested stash was successfully applied, NO otherwise. - (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags checkoutOptions:(nullable GTCheckoutOptions *)options error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock; -/// Pop stashed changes (with a default checkout strategy). +/// Pop stashed changes. /// /// index - The index of the stash to apply. 0 is the most recent stash. /// flags - The flags to use when applying the stash. -/// options - The options to use when checking out. +/// options - The options to use when checking out (if nil, use the defaults provided by libgit2). /// error - If not NULL, set to any error that occurred. /// progressBlock - A block that will be executed on each step of the stash application. /// From 6e7b6c248d98f7ee660670ce280033ed2d47345d Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Thu, 2 Mar 2017 01:33:47 +0100 Subject: [PATCH 131/228] Revert to "default enabled" behavior of checking out when cloning This adds back a renamed version of the old BOOL options and sets a GTCheckoutOptions with sane defaults --- ObjectiveGit/GTRepository.h | 4 ++-- ObjectiveGit/GTRepository.m | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index 9972dda64..1cbc15cca 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -71,10 +71,10 @@ extern NSString * const GTRepositoryCloneOptionsBare; /// An `NSNumber` wrapped `BOOL`, if NO, don't checkout the remote HEAD. /// Default value is `YES`. -extern NSString * const GTRepositoryCloneOptionsCheckout; +extern NSString * const GTRepositoryCloneOptionsPerformCheckout; /// A `GTCheckoutOptions` object describing how to perform the checkout. -extern NSString * const GTRepositoryCloneCheckoutOptions; +extern NSString * const GTRepositoryCloneOptionsCheckoutOptions; /// A `GTCredentialProvider`, that will be used to authenticate against the /// remote. diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index b51d758f3..1c4185ff5 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -60,7 +60,8 @@ #import "git2.h" NSString * const GTRepositoryCloneOptionsBare = @"GTRepositoryCloneOptionsBare"; -NSString * const GTRepositoryCloneCheckoutOptions = @"GTRepositoryCloneCheckoutOptions"; +NSString * const GTRepositoryCloneOptionsPerformCheckout = @"GTRepositoryCloneOptionsPerformCheckout"; +NSString * const GTRepositoryCloneOptionsCheckoutOptions = @"GTRepositoryCloneOptionsCheckoutOptions"; NSString * const GTRepositoryCloneOptionsTransportFlags = @"GTRepositoryCloneOptionsTransportFlags"; NSString * const GTRepositoryCloneOptionsCredentialProvider = @"GTRepositoryCloneOptionsCredentialProvider"; NSString * const GTRepositoryCloneOptionsCloneLocal = @"GTRepositoryCloneOptionsCloneLocal"; @@ -248,7 +249,14 @@ + (nullable instancetype)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSU NSNumber *bare = options[GTRepositoryCloneOptionsBare]; cloneOptions.bare = (bare == nil ? 0 : bare.boolValue); - GTCheckoutOptions *checkoutOptions = options[GTRepositoryCloneCheckoutOptions]; + NSNumber *checkout = options[GTRepositoryCloneOptionsPerformCheckout]; + BOOL doCheckout = (checkout != nil ? [checkout boolValue] : YES); + + GTCheckoutOptions *checkoutOptions = options[GTRepositoryCloneOptionsCheckoutOptions]; + if (checkoutOptions == nil && doCheckout) { + checkoutOptions = [GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategySafe]; + } + if (checkoutOptions != nil) { cloneOptions.checkout_opts = *(checkoutOptions.git_checkoutOptions); } From 386ad1d2e4b9d7186bb00f6da1c620e423681790 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 3 Mar 2017 20:19:32 +0100 Subject: [PATCH 132/228] Documentation fix --- ObjectiveGit/GTRepository.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index 1cbc15cca..d9b099800 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -228,15 +228,14 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// options - A dictionary consisting of the options: /// `GTRepositoryCloneOptionsTransportFlags`, /// `GTRepositoryCloneOptionsBare`, -/// `GTRepositoryCloneCheckoutOptions`, +/// `GTRepositoryCloneOptionsPerformCheckout`, +/// `GTRepositoryCloneOptionsCheckoutOptions`, /// `GTRepositoryCloneOptionsCredentialProvider`, /// `GTRepositoryCloneOptionsCloneLocal`, /// `GTRepositoryCloneOptionsServerCertificateURL` /// error - A pointer to fill in case of trouble. /// transferProgressBlock - This block is called with network transfer updates. /// May be NULL. -/// checkoutProgressBlock - This block is called with checkout updates -/// (if `GTRepositoryCloneOptionsCheckout` is YES). /// May be NULL. /// /// returns nil (and fills the error parameter) if an error occurred, or a GTRepository object if successful. From 0110eab65dde0ef50a0fc66c0188ec69e27cd060 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 3 Mar 2017 20:19:43 +0100 Subject: [PATCH 133/228] Tentative test fixing --- ObjectiveGitTests/GTRepositorySpec.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ObjectiveGitTests/GTRepositorySpec.m b/ObjectiveGitTests/GTRepositorySpec.m index 24fac195f..efe61d1bf 100644 --- a/ObjectiveGitTests/GTRepositorySpec.m +++ b/ObjectiveGitTests/GTRepositorySpec.m @@ -100,7 +100,7 @@ NSDictionary *cloneOptions = @{ GTRepositoryCloneOptionsCloneLocal: @YES, - GTRepositoryCloneCheckoutOptions: checkoutOptions, + GTRepositoryCloneOptionsCheckoutOptions: checkoutOptions, }; repository = [GTRepository cloneFromURL:originURL toWorkingDirectory:workdirURL options:cloneOptions error:&error transferProgressBlock:transferProgressBlock]; expect(repository).notTo(beNil()); @@ -125,7 +125,7 @@ NSDictionary *options = @{ GTRepositoryCloneOptionsBare: @YES, GTRepositoryCloneOptionsCloneLocal: @YES, - GTRepositoryCloneCheckoutOptions: checkoutOptions, + GTRepositoryCloneOptionsCheckoutOptions: checkoutOptions, }; repository = [GTRepository cloneFromURL:originURL toWorkingDirectory:workdirURL options:options error:&error transferProgressBlock:transferProgressBlock]; expect(repository).notTo(beNil()); @@ -147,7 +147,7 @@ GTCheckoutOptions *checkoutOptions = [GTCheckoutOptions checkoutOptionsWithStrategy:GTCheckoutStrategySafe]; checkoutOptions.progressBlock = checkoutProgressBlock; - repository = [GTRepository cloneFromURL:originURL toWorkingDirectory:workdirURL options:@{ GTRepositoryCloneCheckoutOptions: checkoutOptions } error:&error transferProgressBlock:transferProgressBlock]; + repository = [GTRepository cloneFromURL:originURL toWorkingDirectory:workdirURL options:@{ GTRepositoryCloneOptionsCheckoutOptions: checkoutOptions } error:&error transferProgressBlock:transferProgressBlock]; expect(repository).notTo(beNil()); expect(error).to(beNil()); @@ -188,7 +188,7 @@ checkoutOptions.progressBlock = checkoutProgressBlock; NSDictionary *cloneOptions = @{ GTRepositoryCloneOptionsCredentialProvider: provider, - GTRepositoryCloneCheckoutOptions: checkoutOptions, + GTRepositoryCloneOptionsCheckoutOptions: checkoutOptions, }; repository = [GTRepository cloneFromURL:originURL toWorkingDirectory:workdirURL options:cloneOptions error:&error transferProgressBlock:transferProgressBlock]; From bc27d4ee337eed3a6bded5b88406791832b887ee Mon Sep 17 00:00:00 2001 From: nanotech Date: Wed, 8 Mar 2017 23:11:28 -0600 Subject: [PATCH 134/228] Clarify GTDiff options argument documentation The diff initializers refer to their options arguments taking "any of the above options", but both GTDiffOptions and GTDiffFindOptions are defined above them and the diff initializers really only accept GTDiffOptions. --- ObjectiveGit/GTDiff.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ObjectiveGit/GTDiff.h b/ObjectiveGit/GTDiff.h index f25eee875..e6c99726f 100644 --- a/ObjectiveGit/GTDiff.h +++ b/ObjectiveGit/GTDiff.h @@ -193,7 +193,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// newTree - The "right" side of the diff. May be nil to represent an empty /// tree. /// repository - The repository to be used for the diff. Cannot be nil. -/// options - A dictionary containing any of the above options key constants, or +/// options - A dictionary containing any of the GTDiffOptions key constants, or /// nil to use the defaults. /// error - Populated with an `NSError` object on error, if information is /// available. @@ -210,7 +210,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// newIndex - The "right" side of the diff. May be nil to represent an empty /// index. /// repository - The repository to be used for the diff. Cannot be nil. -/// options - A dictionary containing any of the above options key constants, or +/// options - A dictionary containing any of the GTDiffOptions key constants, or /// nil to use the defaults. /// error - Populated with an `NSError` object on error, if information is /// available. @@ -227,7 +227,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// newIndex - The "right" side of the diff. May be nil to represent an empty /// index. /// repository - The repository to be used for the diff. Cannot be nil. -/// options - A dictionary containing any of the above options key constants, or +/// options - A dictionary containing any of the GTDiffOptions key constants, or /// nil to use the defaults. /// error - Populated with an `NSError` object on error, if information is /// available. @@ -247,7 +247,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// repository. The left side of the diff. May be nil to represent an /// empty tree. /// repository - The repository to be used for the diff. -/// options - A dictionary containing any of the above options key constants, or +/// options - A dictionary containing any of the GTDiffOptions key constants, or /// nil to use the defaults. /// error - Populated with an `NSError` object on error, if information is /// available. @@ -260,7 +260,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// This matches the `git diff` command. /// /// repository - The repository to be used for the diff. May not be nil. -/// options - A dictionary containing any of the above options key constants, +/// options - A dictionary containing any of the GTDiffOptions key constants, /// or nil to use the defaults. /// error - Populated with an `NSError` object on error, if information is /// available. @@ -273,7 +273,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// tree - The tree to be diffed. The tree will be the left side of the diff. /// May be nil to represent an empty tree. /// repository - The repository to be used for the diff. May not be nil. -/// options - A dictionary containing any of the above options key constants, or +/// options - A dictionary containing any of the GTDiffOptions key constants, or /// nil to use the defaults. /// error - Populated with an `NSError` object on error, if information is /// available. @@ -287,7 +287,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// the working directory as if everything would be part of the initial commit. /// /// repository - The repository to be used for the diff. May not be nil. -/// options - A dictionary containing any of the above options key constants, +/// options - A dictionary containing any of the GTDiffOptions key constants, /// or nil to use the defaults. /// error - Populated if an error occurs. /// @@ -325,7 +325,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// Modify the diff list to combine similar changes using the given options. /// -/// options - A dictionary containing any of the above find options key constants +/// options - A dictionary containing any of the GTDiffFindOptions key constants /// or nil to use the defaults. - (void)findSimilarWithOptions:(nullable NSDictionary *)options; From ba59006832910571267664454f456a6596aa8eae Mon Sep 17 00:00:00 2001 From: Alexander Hedges Date: Tue, 28 Jun 2016 10:26:09 +0200 Subject: [PATCH 135/228] Replace nullable with _Nullable and so on. --- ObjectiveGit/GTBlame.h | 6 +- ObjectiveGit/GTBlameHunk.h | 6 +- ObjectiveGit/GTBlob.h | 16 ++-- ObjectiveGit/GTBranch.h | 22 ++--- ObjectiveGit/GTBranch.m | 4 +- ObjectiveGit/GTCommit.h | 10 +-- ObjectiveGit/GTConfiguration+Private.h | 2 +- ObjectiveGit/GTConfiguration.h | 8 +- ObjectiveGit/GTCredential.h | 8 +- ObjectiveGit/GTDiff+Private.h | 2 +- ObjectiveGit/GTDiff.h | 18 ++-- ObjectiveGit/GTDiff.m | 2 +- ObjectiveGit/GTDiffDelta.h | 10 +-- ObjectiveGit/GTDiffFile.h | 4 +- ObjectiveGit/GTDiffHunk.h | 2 +- ObjectiveGit/GTDiffLine.h | 2 +- ObjectiveGit/GTDiffPatch.h | 2 +- ObjectiveGit/GTEnumerator.h | 8 +- ObjectiveGit/GTFetchHeadEntry.h | 2 +- ObjectiveGit/GTFilter.h | 6 +- ObjectiveGit/GTFilterList.h | 8 +- ObjectiveGit/GTFilterSource.h | 4 +- ObjectiveGit/GTIndex.h | 24 ++--- ObjectiveGit/GTIndexEntry.h | 8 +- ObjectiveGit/GTNote.h | 10 +-- ObjectiveGit/GTOID.h | 16 ++-- ObjectiveGit/GTObject.h | 14 +-- ObjectiveGit/GTObjectDatabase.h | 8 +- ObjectiveGit/GTOdbObject.h | 8 +- ObjectiveGit/GTReference.h | 22 ++--- ObjectiveGit/GTReflog+Private.h | 2 +- ObjectiveGit/GTReflog.h | 4 +- ObjectiveGit/GTReflogEntry+Private.h | 2 +- ObjectiveGit/GTReflogEntry.h | 8 +- ObjectiveGit/GTRemote.h | 16 ++-- ObjectiveGit/GTRepository+Attributes.h | 2 +- ObjectiveGit/GTRepository+Committing.h | 4 +- ObjectiveGit/GTRepository+Private.h | 4 +- ObjectiveGit/GTRepository+Pull.h | 2 +- ObjectiveGit/GTRepository+References.h | 2 +- ObjectiveGit/GTRepository+RemoteOperations.h | 10 +-- ObjectiveGit/GTRepository+Stashing.h | 8 +- ObjectiveGit/GTRepository+Stashing.m | 14 +-- ObjectiveGit/GTRepository+Status.h | 6 +- ObjectiveGit/GTRepository.h | 92 ++++++++++---------- ObjectiveGit/GTRepository.m | 38 ++++---- ObjectiveGit/GTSignature.h | 12 +-- ObjectiveGit/GTStatusDelta.h | 6 +- ObjectiveGit/GTSubmodule.h | 18 ++-- ObjectiveGit/GTSubmodule.m | 2 +- ObjectiveGit/GTTag.h | 6 +- ObjectiveGit/GTTree.h | 10 +-- ObjectiveGit/GTTreeBuilder.h | 10 +-- ObjectiveGit/GTTreeEntry.h | 16 ++-- ObjectiveGitTests/GTRepositoryStashingSpec.m | 2 +- 55 files changed, 279 insertions(+), 279 deletions(-) diff --git a/ObjectiveGit/GTBlame.h b/ObjectiveGit/GTBlame.h index 22668133d..12db9a5c2 100644 --- a/ObjectiveGit/GTBlame.h +++ b/ObjectiveGit/GTBlame.h @@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN /// blame - A git_blame to wrap. May not be NULL. /// /// Returns a blame, or nil if initialization failed. -- (nullable instancetype)initWithGitBlame:(git_blame *)blame NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithGitBlame:(git_blame *)blame NS_DESIGNATED_INITIALIZER; /// Get all the hunks in the blame. A convenience wrapper around `enumerateHunksUsingBlock:` @property (nonatomic, strong, readonly) NSArray *hunks; @@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN /// index - The index to retrieve the hunk from. /// /// Returns a `GTBlameHunk` or nil if an error occurred. -- (nullable GTBlameHunk *)hunkAtIndex:(NSUInteger)index; +- (GTBlameHunk * _Nullable)hunkAtIndex:(NSUInteger)index; /// Enumerate the hunks in the blame. /// @@ -52,7 +52,7 @@ NS_ASSUME_NONNULL_BEGIN /// lineNumber - The (1 based) line number to find a hunk for. /// /// Returns a `GTBlameHunk` or nil if an error occurred. -- (nullable GTBlameHunk *)hunkAtLineNumber:(NSUInteger)lineNumber; +- (GTBlameHunk * _Nullable)hunkAtLineNumber:(NSUInteger)lineNumber; /// The underlying `git_blame` object. - (git_blame *)git_blame __attribute__((objc_returns_inner_pointer)); diff --git a/ObjectiveGit/GTBlameHunk.h b/ObjectiveGit/GTBlameHunk.h index 9e16c7850..72e3f1764 100644 --- a/ObjectiveGit/GTBlameHunk.h +++ b/ObjectiveGit/GTBlameHunk.h @@ -24,17 +24,17 @@ NS_ASSUME_NONNULL_BEGIN /// hunk - A git_blame_hunk to wrap. May not be NULL. /// /// Returns a blame hunk, or nil if initialization failed. -- (nullable instancetype)initWithGitBlameHunk:(git_blame_hunk)hunk NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithGitBlameHunk:(git_blame_hunk)hunk NS_DESIGNATED_INITIALIZER; /// A NSRange where `location` is the (1 based) starting line number, /// and `length` is the number of lines in the hunk. @property (nonatomic, readonly) NSRange lines; /// The OID of the commit where this hunk was last changed. -@property (nonatomic, readonly, copy, nullable) GTOID *finalCommitOID; +@property (nonatomic, readonly, copy) GTOID * _Nullable finalCommitOID; /// The signature of the commit where this hunk was last changed. -@property (nonatomic, readonly, nullable) GTSignature *finalSignature; +@property (nonatomic, readonly) GTSignature * _Nullable finalSignature; /// The path of the file in the original commit. @property (nonatomic, readonly, copy) NSString *originalPath; diff --git a/ObjectiveGit/GTBlob.h b/ObjectiveGit/GTBlob.h index 25910c296..5ab16a990 100644 --- a/ObjectiveGit/GTBlob.h +++ b/ObjectiveGit/GTBlob.h @@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - Will be set if an error occurs. This may be nil. /// /// Return a newly created blob object, or nil if an error occurs. -+ (nullable instancetype)blobWithString:(NSString *)string inRepository:(GTRepository *)repository error:(NSError **)error; ++ (instancetype _Nullable)blobWithString:(NSString *)string inRepository:(GTRepository *)repository error:(NSError **)error; /// Creates a new blob from the given data. /// @@ -54,7 +54,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - Will be set if an error occurs. This may be nil. /// /// Return a newly created blob object, or nil if an error occurs. -+ (nullable instancetype)blobWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError **)error; ++ (instancetype _Nullable)blobWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError **)error; /// Creates a new blob given an NSURL to a file. /// @@ -65,7 +65,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - Will be set if an error occurs. This may be nil. /// /// Return a newly created blob object, or nil if an error occurs. -+ (nullable instancetype)blobWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError **)error; ++ (instancetype _Nullable)blobWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError **)error; /// Creates a new blob from the given string. /// @@ -76,7 +76,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - Will be set if an error occurs. This may be nil. /// /// Return a newly created blob object, or nil if an error occurs. -- (nullable instancetype)initWithString:(NSString *)string inRepository:(GTRepository *)repository error:(NSError **)error; +- (instancetype _Nullable)initWithString:(NSString *)string inRepository:(GTRepository *)repository error:(NSError **)error; /// Creates a new blob from the passed data. /// @@ -87,7 +87,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - Will be set if an error occurs. This may be nil. /// /// Returns a newly created blob object, or nil if an error occurs. -- (nullable instancetype)initWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError **)error; +- (instancetype _Nullable)initWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError **)error; /// Creates a new blob from the specified file. /// @@ -98,14 +98,14 @@ NS_ASSUME_NONNULL_BEGIN /// error - Will be set if an error occurs. This may be nil. /// /// Returns a newly created blob object, or nil if an error occurs. -- (nullable instancetype)initWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError **)error; +- (instancetype _Nullable)initWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError **)error; /// The underlying `git_object` as a `git_blob` object. - (git_blob *)git_blob __attribute__((objc_returns_inner_pointer)); - (git_off_t)size; - (NSString *)content; -- (nullable NSData *)data; +- (NSData * _Nullable)data; /// Attempts to apply the filter list for `path` to the blob. /// @@ -113,7 +113,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs. /// /// Returns the filtered data, or nil if an error occurs. -- (nullable NSData *)applyFiltersForPath:(NSString *)path error:(NSError **)error; +- (NSData * _Nullable)applyFiltersForPath:(NSString *)path error:(NSError **)error; @end diff --git a/ObjectiveGit/GTBranch.h b/ObjectiveGit/GTBranch.h index 4a8766357..d53977643 100644 --- a/ObjectiveGit/GTBranch.h +++ b/ObjectiveGit/GTBranch.h @@ -43,10 +43,10 @@ NS_ASSUME_NONNULL_BEGIN /// equal. @interface GTBranch : NSObject -@property (nonatomic, readonly, nullable) NSString *name; -@property (nonatomic, readonly, nullable) NSString *shortName; -@property (nonatomic, copy, readonly, nullable) GTOID *OID; -@property (nonatomic, readonly, nullable) NSString *remoteName; +@property (nonatomic, readonly) NSString * _Nullable name; +@property (nonatomic, readonly) NSString * _Nullable shortName; +@property (nonatomic, copy, readonly) GTOID * _Nullable OID; +@property (nonatomic, readonly) NSString * _Nullable remoteName; @property (nonatomic, readonly) GTBranchType branchType; @property (nonatomic, readonly, strong) GTRepository *repository; @property (nonatomic, readonly, strong) GTReference *reference; @@ -62,7 +62,7 @@ NS_ASSUME_NONNULL_BEGIN /// repo - The repository containing the branch. Must not be nil. /// /// Returns the initialized receiver. -- (nullable instancetype)initWithReference:(GTReference *)ref repository:(GTRepository *)repo NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithReference:(GTReference *)ref repository:(GTRepository *)repo NS_DESIGNATED_INITIALIZER; /// Convenience class initializer. /// @@ -70,14 +70,14 @@ NS_ASSUME_NONNULL_BEGIN /// repo - The repository containing the branch. Must not be nil. /// /// Returns an initialized instance. -+ (nullable instancetype)branchWithReference:(GTReference *)ref repository:(GTRepository *)repo; ++ (instancetype _Nullable)branchWithReference:(GTReference *)ref repository:(GTRepository *)repo; /// Get the target commit for this branch /// /// error(out) - will be filled if an error occurs /// /// returns a GTCommit object or nil if an error occurred -- (nullable GTCommit *)targetCommitWithError:(NSError **)error; +- (GTCommit * _Nullable)targetCommitWithError:(NSError **)error; /// Count all commits in this branch /// @@ -92,7 +92,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs. /// /// Returns a (possibly empty) array of GTCommits, or nil if an error occurs. -- (nullable NSArray *)uniqueCommitsRelativeToBranch:(GTBranch *)otherBranch error:(NSError **)error; +- (NSArray * _Nullable)uniqueCommitsRelativeToBranch:(GTBranch *)otherBranch error:(NSError **)error; /// Deletes the local branch and nils out the reference. - (BOOL)deleteWithError:(NSError **)error; @@ -100,7 +100,7 @@ NS_ASSUME_NONNULL_BEGIN /// If the receiver is a local branch, looks up and returns its tracking branch. /// If the receiver is a remote branch, returns self. If no tracking branch was /// found, returns nil and sets `success` to YES. -- (nullable GTBranch *)trackingBranchWithError:(NSError **)error success:(nullable BOOL *)success; +- (GTBranch * _Nullable)trackingBranchWithError:(NSError **)error success:(BOOL * _Nullable)success; /// Update the tracking branch. /// @@ -109,7 +109,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - The error if one occurred. /// /// Returns whether it was successful. -- (BOOL)updateTrackingBranch:(nullable GTBranch *)trackingBranch error:(NSError **)error; +- (BOOL)updateTrackingBranch:(GTBranch * _Nullable)trackingBranch error:(NSError **)error; /// Reloads the branch's reference and creates a new branch based off that newly /// loaded reference. @@ -119,7 +119,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - The error if one occurred. /// /// Returns the reloaded branch, or nil if an error occurred. -- (nullable GTBranch *)reloadedBranchWithError:(NSError **)error; +- (GTBranch * _Nullable)reloadedBranchWithError:(NSError **)error; /// Calculate the ahead/behind count from this branch to the given branch. /// diff --git a/ObjectiveGit/GTBranch.m b/ObjectiveGit/GTBranch.m index 9567a9874..eb42f3356 100644 --- a/ObjectiveGit/GTBranch.m +++ b/ObjectiveGit/GTBranch.m @@ -65,7 +65,7 @@ + (NSString *)remoteNamePrefix { return @"refs/remotes/"; } -+ (nullable instancetype)branchWithReference:(GTReference *)ref repository:(GTRepository *)repo { ++ (instancetype)branchWithReference:(GTReference *)ref repository:(GTRepository *)repo { return [[self alloc] initWithReference:ref repository:repo]; } @@ -74,7 +74,7 @@ - (instancetype)init { return nil; } -- (nullable instancetype)initWithReference:(GTReference *)ref repository:(GTRepository *)repo { +- (instancetype)initWithReference:(GTReference *)ref repository:(GTRepository *)repo { NSParameterAssert(ref != nil); NSParameterAssert(repo != nil); diff --git a/ObjectiveGit/GTCommit.h b/ObjectiveGit/GTCommit.h index cf4bc0373..af84a0e4f 100644 --- a/ObjectiveGit/GTCommit.h +++ b/ObjectiveGit/GTCommit.h @@ -39,15 +39,15 @@ NS_ASSUME_NONNULL_BEGIN @interface GTCommit : GTObject {} -@property (nonatomic, readonly, strong, nullable) GTSignature *author; -@property (nonatomic, readonly, strong, nullable) GTSignature *committer; +@property (nonatomic, readonly, strong) GTSignature * _Nullable author; +@property (nonatomic, readonly, strong) GTSignature * _Nullable committer; @property (nonatomic, readonly, copy) NSArray *parents; -@property (nonatomic, readonly, nullable) NSString *message; +@property (nonatomic, readonly) NSString * _Nullable message; @property (nonatomic, readonly) NSString *messageDetails; @property (nonatomic, readonly) NSString *messageSummary; @property (nonatomic, readonly) NSDate *commitDate; @property (nonatomic, readonly) NSTimeZone *commitTimeZone; -@property (nonatomic, readonly, nullable) GTTree *tree; +@property (nonatomic, readonly) GTTree * _Nullable tree; /// Is this a merge commit? @property (nonatomic, readonly, assign, getter = isMerge) BOOL merge; @@ -64,7 +64,7 @@ NS_ASSUME_NONNULL_BEGIN /// /// Returns an index which represents the result of the merge, or nil if an error /// occurred. -- (nullable GTIndex *)merge:(GTCommit *)otherCommit error:(NSError **)error; +- (GTIndex * _Nullable)merge:(GTCommit *)otherCommit error:(NSError **)error; @end diff --git a/ObjectiveGit/GTConfiguration+Private.h b/ObjectiveGit/GTConfiguration+Private.h index efd0598ec..03b6f4f12 100644 --- a/ObjectiveGit/GTConfiguration+Private.h +++ b/ObjectiveGit/GTConfiguration+Private.h @@ -18,6 +18,6 @@ /// repository - The repository in which the config resides. May be nil. /// /// Returns the initialized object. -- (nullable instancetype)initWithGitConfig:(nonnull git_config *)config repository:(nullable GTRepository *)repository NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithGitConfig:(git_config * _Nonnull)config repository:(GTRepository * _Nullable)repository NS_DESIGNATED_INITIALIZER; @end diff --git a/ObjectiveGit/GTConfiguration.h b/ObjectiveGit/GTConfiguration.h index 1e67030c1..6c4df90a4 100644 --- a/ObjectiveGit/GTConfiguration.h +++ b/ObjectiveGit/GTConfiguration.h @@ -17,24 +17,24 @@ NS_ASSUME_NONNULL_BEGIN @interface GTConfiguration : NSObject -@property (nonatomic, readonly, strong, nullable) GTRepository *repository; +@property (nonatomic, readonly, strong) GTRepository * _Nullable repository; @property (nonatomic, readonly, copy) NSArray *configurationKeys; /// The GTRemotes in the config. If the configuration isn't associated with any /// repository, this will always be nil. -@property (nonatomic, readonly, copy, nullable) NSArray *remotes; +@property (nonatomic, readonly, copy) NSArray * _Nullable remotes; - (instancetype)init NS_UNAVAILABLE; /// Creates and returns a configuration which includes the global, XDG, and /// system configurations. -+ (nullable instancetype)defaultConfiguration; ++ (instancetype _Nullable)defaultConfiguration; /// The underlying `git_config` object. - (git_config *)git_config __attribute__((objc_returns_inner_pointer)); - (void)setString:(NSString *)s forKey:(NSString *)key; -- (nullable NSString *)stringForKey:(NSString *)key; +- (NSString * _Nullable)stringForKey:(NSString *)key; - (void)setBool:(BOOL)b forKey:(NSString *)key; - (BOOL)boolForKey:(NSString *)key; diff --git a/ObjectiveGit/GTCredential.h b/ObjectiveGit/GTCredential.h index 0bb210ab5..560a8ba18 100644 --- a/ObjectiveGit/GTCredential.h +++ b/ObjectiveGit/GTCredential.h @@ -46,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN /// type - the credential types allowed by the operation. /// URL - the URL the operation is authenticating against. /// userName - the user name provided by the operation. Can be nil, and might be ignored. -- (GTCredential * _Nullable)credentialForType:(GTCredentialType)type URL:(nullable NSString *)URL userName:(nullable NSString *)userName; +- (GTCredential * _Nullable)credentialForType:(GTCredentialType)type URL:(NSString * _Nullable)URL userName:(NSString * _Nullable)userName; @end /// The GTCredential class is used to provide authentication data. @@ -60,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any errors that occur. /// /// Return a new GTCredential instance, or nil if an error occurred -+ (nullable instancetype)credentialWithUserName:(NSString *)userName password:(NSString *)password error:(NSError **)error; ++ (instancetype _Nullable)credentialWithUserName:(NSString *)userName password:(NSString *)password error:(NSError **)error; /// Create a credential object from a SSH keyfile /// @@ -72,7 +72,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any errors that occur. /// /// Return a new GTCredential instance, or nil if an error occurred -+ (nullable instancetype)credentialWithUserName:(NSString *)userName publicKeyURL:(nullable NSURL *)publicKeyURL privateKeyURL:(NSURL *)privateKeyURL passphrase:(nullable NSString *)passphrase error:(NSError **)error; ++ (instancetype _Nullable)credentialWithUserName:(NSString *)userName publicKeyURL:(NSURL * _Nullable)publicKeyURL privateKeyURL:(NSURL *)privateKeyURL passphrase:(NSString * _Nullable)passphrase error:(NSError **)error; /// Create a credential object from a SSH keyfile data string /// @@ -84,7 +84,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any errors that occur. /// /// Return a new GTCredential instance, or nil if an error occurred -+ (nullable instancetype)credentialWithUserName:(NSString *)userName publicKeyString:(nullable NSString *)publicKeyString privateKeyString:(NSString *)privateKeyString passphrase:(nullable NSString *)passphrase error:(NSError **)error; ++ (instancetype _Nullable)credentialWithUserName:(NSString *)userName publicKeyString:(NSString * _Nullable)publicKeyString privateKeyString:(NSString *)privateKeyString passphrase:(NSString * _Nullable)passphrase error:(NSError **)error; /// The underlying `git_cred` object. - (git_cred *)git_cred __attribute__((objc_returns_inner_pointer)); diff --git a/ObjectiveGit/GTDiff+Private.h b/ObjectiveGit/GTDiff+Private.h index 03b7f9146..bcf640921 100644 --- a/ObjectiveGit/GTDiff+Private.h +++ b/ObjectiveGit/GTDiff+Private.h @@ -14,6 +14,6 @@ /// provides a pointer to that structure to the given `block`. /// /// Returns the result of invoking `block`. -+ (int)handleParsedOptionsDictionary:(nullable NSDictionary *)dictionary usingBlock:(nonnull int (^)(git_diff_options * __null_unspecified optionsStruct))block; ++ (int)handleParsedOptionsDictionary:(NSDictionary * _Nullable)dictionary usingBlock:(int (^ _Nonnull)(git_diff_options * _Null_unspecified optionsStruct))block; @end diff --git a/ObjectiveGit/GTDiff.h b/ObjectiveGit/GTDiff.h index f25eee875..991bb5c95 100644 --- a/ObjectiveGit/GTDiff.h +++ b/ObjectiveGit/GTDiff.h @@ -199,7 +199,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// available. /// /// Returns a newly created `GTDiff` object or nil on error. -+ (nullable instancetype)diffOldTree:(nullable GTTree *)oldTree withNewTree:(nullable GTTree *)newTree inRepository:(GTRepository *)repository options:(nullable NSDictionary *)options error:(NSError **)error; ++ (instancetype _Nullable)diffOldTree:(GTTree * _Nullable)oldTree withNewTree:(GTTree * _Nullable)newTree inRepository:(GTRepository *)repository options:(NSDictionary * _Nullable)options error:(NSError **)error; /// Create a diff between `GTTree` and `GTIndex`. /// @@ -216,7 +216,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// available. /// /// Returns a newly created `GTDiff` object or nil on error. -+ (nullable instancetype)diffOldTree:(nullable GTTree *)oldTree withNewIndex:(nullable GTIndex *)newIndex inRepository:(GTRepository *)repository options:(nullable NSDictionary *)options error:(NSError **)error; ++ (instancetype _Nullable)diffOldTree:(GTTree * _Nullable)oldTree withNewIndex:(GTIndex * _Nullable)newIndex inRepository:(GTRepository *)repository options:(NSDictionary * _Nullable)options error:(NSError **)error; /// Create a diff between two `GTIndex`es. /// @@ -233,7 +233,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// available. /// /// Returns a newly created `GTDiff` object or nil on error. -+ (nullable instancetype)diffOldIndex:(nullable GTIndex *)oldIndex withNewIndex:(nullable GTIndex *)newIndex inRepository:(GTRepository *)repository options:(nullable NSDictionary *)options error:(NSError **)error; ++ (instancetype _Nullable)diffOldIndex:(GTIndex * _Nullable)oldIndex withNewIndex:(GTIndex * _Nullable)newIndex inRepository:(GTRepository *)repository options:(NSDictionary * _Nullable)options error:(NSError **)error; /// Create a diff between a repository's current index. /// @@ -253,7 +253,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// available. /// /// Returns a newly created `GTDiff` object or nil on error. -+ (nullable instancetype)diffIndexFromTree:(nullable GTTree *)tree inRepository:(nullable GTRepository *)repository options:(nullable NSDictionary *)options error:(NSError **)error; ++ (instancetype _Nullable)diffIndexFromTree:(GTTree * _Nullable)tree inRepository:(GTRepository * _Nullable)repository options:(NSDictionary * _Nullable)options error:(NSError **)error; /// Create a diff between the index and working directory in a given repository. /// @@ -266,7 +266,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// available. /// /// Returns a newly created `GTDiff` object or nil on error. -+ (nullable instancetype)diffIndexToWorkingDirectoryInRepository:(GTRepository *)repository options:(nullable NSDictionary *)options error:(NSError **)error; ++ (instancetype _Nullable)diffIndexToWorkingDirectoryInRepository:(GTRepository *)repository options:(NSDictionary * _Nullable)options error:(NSError **)error; /// Create a diff between a repository's working directory and a tree. /// @@ -279,7 +279,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// available. /// /// Returns a newly created `GTDiff` object or nil on error. -+ (nullable instancetype)diffWorkingDirectoryFromTree:(nullable GTTree *)tree inRepository:(GTRepository *)repository options:(nullable NSDictionary *)options error:(NSError **)error; ++ (instancetype _Nullable)diffWorkingDirectoryFromTree:(GTTree * _Nullable)tree inRepository:(GTRepository *)repository options:(NSDictionary * _Nullable)options error:(NSError **)error; /// Create a diff between the working directory and HEAD. /// @@ -292,7 +292,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// error - Populated if an error occurs. /// /// Returns a newly created GTDiff, or nil if an error occurred. -+ (nullable instancetype)diffWorkingDirectoryToHEADInRepository:(GTRepository *)repository options:(nullable NSDictionary *)options error:(NSError **)error; ++ (instancetype _Nullable)diffWorkingDirectoryToHEADInRepository:(GTRepository *)repository options:(NSDictionary * _Nullable)options error:(NSError **)error; - (instancetype)init NS_UNAVAILABLE; @@ -302,7 +302,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// repository - The repository in which the diff lives. Cannot be nil. /// /// Returns the initialized object. -- (nullable instancetype)initWithGitDiff:(git_diff *)diff repository:(GTRepository *)repository NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithGitDiff:(git_diff *)diff repository:(GTRepository *)repository NS_DESIGNATED_INITIALIZER; /// The libgit2 diff object. - (git_diff *)git_diff __attribute__((objc_returns_inner_pointer)); @@ -327,7 +327,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) { /// /// options - A dictionary containing any of the above find options key constants /// or nil to use the defaults. -- (void)findSimilarWithOptions:(nullable NSDictionary *)options; +- (void)findSimilarWithOptions:(NSDictionary * _Nullable)options; /// Merge a diff with another diff. /// diff --git a/ObjectiveGit/GTDiff.m b/ObjectiveGit/GTDiff.m index c0945d3b4..b3de61898 100644 --- a/ObjectiveGit/GTDiff.m +++ b/ObjectiveGit/GTDiff.m @@ -110,7 +110,7 @@ + (instancetype)diffOldTree:(GTTree *)oldTree withNewIndex:(GTIndex *)newIndex i return [[self alloc] initWithGitDiff:diff repository:repository]; } -+ (nullable instancetype)diffOldIndex:(GTIndex *)oldIndex withNewIndex:(GTIndex *)newIndex inRepository:(GTRepository *)repository options:(NSDictionary *)options error:(NSError **)error ++ (instancetype)diffOldIndex:(GTIndex *)oldIndex withNewIndex:(GTIndex *)newIndex inRepository:(GTRepository *)repository options:(NSDictionary *)options error:(NSError **)error { NSParameterAssert(repository != nil); diff --git a/ObjectiveGit/GTDiffDelta.h b/ObjectiveGit/GTDiffDelta.h index 0c3c83eb4..88bd2bad9 100644 --- a/ObjectiveGit/GTDiffDelta.h +++ b/ObjectiveGit/GTDiffDelta.h @@ -88,7 +88,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs. /// /// Returns a diff delta, or nil if an error occurs. -+ (nullable instancetype)diffDeltaFromBlob:(nullable GTBlob *)oldBlob forPath:(nullable NSString *)oldBlobPath toBlob:(nullable GTBlob *)newBlob forPath:(nullable NSString *)newBlobPath options:(nullable NSDictionary *)options error:(NSError **)error; ++ (instancetype _Nullable)diffDeltaFromBlob:(GTBlob * _Nullable)oldBlob forPath:(NSString * _Nullable)oldBlobPath toBlob:(GTBlob * _Nullable)newBlob forPath:(NSString * _Nullable)newBlobPath options:(NSDictionary * _Nullable)options error:(NSError **)error; /// Diffs the given blob and data buffer. /// @@ -103,7 +103,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs. /// /// Returns a diff delta, or nil if an error occurs. -+ (nullable instancetype)diffDeltaFromBlob:(nullable GTBlob *)blob forPath:(nullable NSString *)blobPath toData:(nullable NSData *)data forPath:(nullable NSString *)dataPath options:(nullable NSDictionary *)options error:(NSError **)error; ++ (instancetype _Nullable)diffDeltaFromBlob:(GTBlob * _Nullable)blob forPath:(NSString * _Nullable)blobPath toData:(NSData * _Nullable)data forPath:(NSString * _Nullable)dataPath options:(NSDictionary * _Nullable)options error:(NSError **)error; /// Diffs the given data buffers. /// @@ -118,7 +118,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs. /// /// Returns a diff delta, or nil if an error occurs. -+ (nullable instancetype)diffDeltaFromData:(nullable NSData *)oldData forPath:(nullable NSString *)oldDataPath toData:(nullable NSData *)newData forPath:(nullable NSString *)newDataPath options:(nullable NSDictionary *)options error:(NSError **)error; ++ (instancetype _Nullable)diffDeltaFromData:(NSData * _Nullable)oldData forPath:(NSString * _Nullable)oldDataPath toData:(NSData * _Nullable)newData forPath:(NSString * _Nullable)newDataPath options:(NSDictionary * _Nullable)options error:(NSError **)error; - (instancetype)init NS_UNAVAILABLE; @@ -128,7 +128,7 @@ NS_ASSUME_NONNULL_BEGIN /// deltaIndex - The index of the delta within the diff. /// /// Returns a diff delta, or nil if an error occurs. -- (nullable instancetype)initWithDiff:(GTDiff *)diff deltaIndex:(NSUInteger)deltaIndex; +- (instancetype _Nullable)initWithDiff:(GTDiff *)diff deltaIndex:(NSUInteger)deltaIndex; /// Creates a patch from a text delta. /// @@ -137,7 +137,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs. /// /// Returns a new patch, or nil if an error occurs. -- (nullable GTDiffPatch *)generatePatch:(NSError **)error; +- (GTDiffPatch * _Nullable)generatePatch:(NSError **)error; @end diff --git a/ObjectiveGit/GTDiffFile.h b/ObjectiveGit/GTDiffFile.h index 5f277ff28..e88935ffb 100644 --- a/ObjectiveGit/GTDiffFile.h +++ b/ObjectiveGit/GTDiffFile.h @@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly) mode_t mode; /// The OID for the file. -@property (nonatomic, readonly, copy, nullable) GTOID *OID; +@property (nonatomic, readonly, copy) GTOID * _Nullable OID; /// The git_diff_file represented by the receiver. @property (nonatomic, readonly) git_diff_file git_diff_file; @@ -55,7 +55,7 @@ NS_ASSUME_NONNULL_BEGIN /// file - The git_diff_file wrapped by the receiver. /// /// Returns an initialized GTDiffFile. -- (nullable instancetype)initWithGitDiffFile:(git_diff_file)file NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithGitDiffFile:(git_diff_file)file NS_DESIGNATED_INITIALIZER; @end diff --git a/ObjectiveGit/GTDiffHunk.h b/ObjectiveGit/GTDiffHunk.h index 8c3653efe..164185e58 100644 --- a/ObjectiveGit/GTDiffHunk.h +++ b/ObjectiveGit/GTDiffHunk.h @@ -45,7 +45,7 @@ NS_ASSUME_NONNULL_BEGIN /// hunkIndex - The hunk's index within the patch. /// /// Returns the initialized instance. -- (nullable instancetype)initWithPatch:(GTDiffPatch *)patch hunkIndex:(NSUInteger)hunkIndex NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithPatch:(GTDiffPatch *)patch hunkIndex:(NSUInteger)hunkIndex NS_DESIGNATED_INITIALIZER; /// Perfoms the given block on each line in the hunk. /// diff --git a/ObjectiveGit/GTDiffLine.h b/ObjectiveGit/GTDiffLine.h index bb54d2234..26dc1949f 100644 --- a/ObjectiveGit/GTDiffLine.h +++ b/ObjectiveGit/GTDiffLine.h @@ -52,7 +52,7 @@ NS_ASSUME_NONNULL_BEGIN /// line - The diff line to wrap. May not be NULL. /// /// Returns a diff line, or nil if an error occurs. -- (nullable instancetype)initWithGitLine:(const git_diff_line *)line NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithGitLine:(const git_diff_line *)line NS_DESIGNATED_INITIALIZER; @end diff --git a/ObjectiveGit/GTDiffPatch.h b/ObjectiveGit/GTDiffPatch.h index 86971a6f0..a76b6de9e 100644 --- a/ObjectiveGit/GTDiffPatch.h +++ b/ObjectiveGit/GTDiffPatch.h @@ -40,7 +40,7 @@ NS_ASSUME_NONNULL_BEGIN /// automatically be freed when the receiver is deallocated. Must not be /// NULL. /// delta - The diff delta corresponding to this patch. Must not be nil. -- (nullable instancetype)initWithGitPatch:(git_patch *)patch delta:(GTDiffDelta *)delta NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithGitPatch:(git_patch *)patch delta:(GTDiffDelta *)delta NS_DESIGNATED_INITIALIZER; /// Returns the underlying patch object. - (git_patch *)git_patch __attribute__((objc_returns_inner_pointer)); diff --git a/ObjectiveGit/GTEnumerator.h b/ObjectiveGit/GTEnumerator.h index 900d3e60a..2ab38b841 100644 --- a/ObjectiveGit/GTEnumerator.h +++ b/ObjectiveGit/GTEnumerator.h @@ -70,7 +70,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs. /// /// Returns an initialized enumerator, or nil if an error occurs. -- (nullable id)initWithRepository:(GTRepository *)repo error:(NSError **)error NS_DESIGNATED_INITIALIZER; +- (id _Nullable)initWithRepository:(GTRepository *)repo error:(NSError **)error NS_DESIGNATED_INITIALIZER; /// Marks a commit to start traversal from. /// @@ -115,7 +115,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs during traversal. /// /// Returns a (possibly empty) array of GTCommits, or nil if an error occurs. -- (nullable NSArray *)allObjectsWithError:(NSError **)error; +- (NSArray * _Nullable)allObjectsWithError:(NSError **)error; /// Get the next OID. /// @@ -125,7 +125,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs during traversal. /// /// Returns nil if an error occurs or the enumeration is done. -- (nullable GTOID *)nextOIDWithSuccess:(nullable BOOL *)success error:(NSError **)error; +- (GTOID * _Nullable)nextOIDWithSuccess:(BOOL * _Nullable)success error:(NSError **)error; /// Gets the next commit. /// @@ -135,7 +135,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs during traversal. /// /// Returns nil if an error occurs or the receiver is exhausted. -- (nullable GTCommit *)nextObjectWithSuccess:(nullable BOOL *)success error:(NSError **)error; +- (GTCommit * _Nullable)nextObjectWithSuccess:(BOOL * _Nullable)success error:(NSError **)error; /// Counts the number of commits that were not enumerated, completely exhausting /// the receiver. diff --git a/ObjectiveGit/GTFetchHeadEntry.h b/ObjectiveGit/GTFetchHeadEntry.h index 20b2b9a2f..fd6fa466f 100644 --- a/ObjectiveGit/GTFetchHeadEntry.h +++ b/ObjectiveGit/GTFetchHeadEntry.h @@ -39,7 +39,7 @@ NS_ASSUME_NONNULL_BEGIN /// merge - Indicates if this is pending a merge. /// /// Returns an initialized fetch head entry, or nil if an error occurred. -- (nullable instancetype)initWithReference:(GTReference *)reference remoteURLString:(NSString *)remoteURLString targetOID:(GTOID *)targetOID isMerge:(BOOL)merge NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithReference:(GTReference *)reference remoteURLString:(NSString *)remoteURLString targetOID:(GTOID *)targetOID isMerge:(BOOL)merge NS_DESIGNATED_INITIALIZER; @end diff --git a/ObjectiveGit/GTFilter.h b/ObjectiveGit/GTFilter.h index 8f70cc5e3..51b2e7196 100644 --- a/ObjectiveGit/GTFilter.h +++ b/ObjectiveGit/GTFilter.h @@ -34,7 +34,7 @@ extern const NSInteger GTFilterErrorNameAlreadyRegistered; /// The check block. Determines whether the `applyBlock` should be run for given /// source. -@property (nonatomic, copy) BOOL (^checkBlock)(void * __null_unspecified * __null_unspecified payload, GTFilterSource *source, const char * __null_unspecified * __null_unspecified attr_values); +@property (nonatomic, copy) BOOL (^checkBlock)(void * _Null_unspecified * _Null_unspecified payload, GTFilterSource *source, const char * _Null_unspecified * _Null_unspecified attr_values); /// The cleanup block. Called after the `applyBlock` to given the filter a /// chance to clean up the `payload`. @@ -49,7 +49,7 @@ extern const NSInteger GTFilterErrorNameAlreadyRegistered; /// applyBlock - The block to use to apply the filter. Cannot be nil. /// /// Returns the initialized object. -- (nullable instancetype)initWithName:(NSString *)name attributes:(nullable NSString *)attributes applyBlock:(NSData * (^)(void *__null_unspecified * __null_unspecified payload, NSData *from, GTFilterSource *source, BOOL *applied))applyBlock NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithName:(NSString *)name attributes:(NSString * _Nullable)attributes applyBlock:(NSData * (^)(void * _Null_unspecified * _Null_unspecified payload, NSData *from, GTFilterSource *source, BOOL *applied))applyBlock NS_DESIGNATED_INITIALIZER; /// Look up a filter based on its name. /// @@ -59,7 +59,7 @@ extern const NSInteger GTFilterErrorNameAlreadyRegistered; /// name - The name of the filter to retrieve. Must not be nil. /// /// Returns the filter, or nil if none was found. -+ (nullable GTFilter *)filterForName:(NSString *)name; ++ (GTFilter * _Nullable)filterForName:(NSString *)name; /// Registers the filter with the given priority. /// diff --git a/ObjectiveGit/GTFilterList.h b/ObjectiveGit/GTFilterList.h index 7b45f4b70..6ddf3ca98 100644 --- a/ObjectiveGit/GTFilterList.h +++ b/ObjectiveGit/GTFilterList.h @@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN /// Must not be NULL. /// /// Returns an initialized filter list, or nil if an error occurred. -- (nullable instancetype)initWithGitFilterList:(git_filter_list *)filterList NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithGitFilterList:(git_filter_list *)filterList NS_DESIGNATED_INITIALIZER; /// Returns the underlying `git_filter_list`. - (git_filter_list *)git_filter_list __attribute__((objc_returns_inner_pointer)); @@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs. /// /// Returns the filtered data, or nil if an error occurs. -- (nullable NSData *)applyToData:(NSData *)inputData error:(NSError **)error; +- (NSData * _Nullable)applyToData:(NSData *)inputData error:(NSError **)error; /// Attempts to apply the filter list to a file in the given repository. /// @@ -53,7 +53,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs. /// /// Returns the filtered data, or nil if an error occurs. -- (nullable NSData *)applyToPath:(NSString *)relativePath inRepository:(GTRepository *)repository error:(NSError **)error; +- (NSData * _Nullable)applyToPath:(NSString *)relativePath inRepository:(GTRepository *)repository error:(NSError **)error; /// Attempts to apply the filter list to a blob. /// @@ -61,7 +61,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs. /// /// Returns the filtered data, or nil if an error occurs. -- (nullable NSData *)applyToBlob:(GTBlob *)blob error:(NSError **)error; +- (NSData * _Nullable)applyToBlob:(GTBlob *)blob error:(NSError **)error; @end diff --git a/ObjectiveGit/GTFilterSource.h b/ObjectiveGit/GTFilterSource.h index e7d60c2cc..e168846d0 100644 --- a/ObjectiveGit/GTFilterSource.h +++ b/ObjectiveGit/GTFilterSource.h @@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN /// The OID of the source. Will be nil if the source doesn't exist in the object /// database. -@property (nonatomic, readonly, strong, nullable) GTOID *OID; +@property (nonatomic, readonly, strong) GTOID * _Nullable OID; /// The filter mode. @property (nonatomic, readonly, assign) GTFilterSourceMode mode; @@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN /// source - The filter source. Cannot be NULL. /// /// Returns the initialized object. -- (nullable instancetype)initWithGitFilterSource:(const git_filter_source *)source NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithGitFilterSource:(const git_filter_source *)source NS_DESIGNATED_INITIALIZER; @end diff --git a/ObjectiveGit/GTIndex.h b/ObjectiveGit/GTIndex.h index 8d4c7919b..ba57ac2f3 100644 --- a/ObjectiveGit/GTIndex.h +++ b/ObjectiveGit/GTIndex.h @@ -40,10 +40,10 @@ NS_ASSUME_NONNULL_BEGIN /// The repository in which the index resides. This may be nil if the index was /// created with -initWithFileURL:error:. -@property (nonatomic, readonly, strong, nullable) GTRepository *repository; +@property (nonatomic, readonly, strong) GTRepository * _Nullable repository; /// The file URL for the index if it exists on disk; nil otherwise. -@property (nonatomic, readonly, copy, nullable) NSURL *fileURL; +@property (nonatomic, readonly, copy) NSURL * _Nullable fileURL; /// The number of entries in the index. @property (nonatomic, readonly) NSUInteger entryCount; @@ -60,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs. /// /// Returns the newly created index, or nil if an error occurred. -+ (nullable instancetype)inMemoryIndexWithRepository:(GTRepository *)repository error:(NSError **)error; ++ (instancetype _Nullable)inMemoryIndexWithRepository:(GTRepository *)repository error:(NSError **)error; /// Loads the index at the given file URL. /// @@ -69,7 +69,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - If not NULL, set to any error that occurs. /// /// Returns the loaded index, or nil if an error occurred. -+ (nullable instancetype)indexWithFileURL:(NSURL *)fileURL repository:(GTRepository *)repository error:(NSError **)error; ++ (instancetype _Nullable)indexWithFileURL:(NSURL *)fileURL repository:(GTRepository *)repository error:(NSError **)error; - (instancetype)init NS_UNAVAILABLE; @@ -105,10 +105,10 @@ NS_ASSUME_NONNULL_BEGIN /// index - The index of the entry to get. Must be within 0 and self.entryCount. /// /// Returns a new GTIndexEntry, or nil if an error occurred. -- (nullable GTIndexEntry *)entryAtIndex:(NSUInteger)index; +- (GTIndexEntry * _Nullable)entryAtIndex:(NSUInteger)index; /// Get the entry with the given path, or nil if an error occurred. -- (nullable GTIndexEntry *)entryWithPath:(NSString *)path; +- (GTIndexEntry * _Nullable)entryWithPath:(NSString *)path; /// Get the entry with the given name. /// @@ -116,7 +116,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - The error if one occurred. /// /// Returns a new GTIndexEntry, or nil if an error occurred. -- (nullable GTIndexEntry *)entryWithPath:(NSString *)path error:(NSError **)error; +- (GTIndexEntry * _Nullable)entryWithPath:(NSString *)path error:(NSError **)error; /// Add an entry to the index. /// @@ -179,7 +179,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - The error if one occurred. /// /// Returns a new GTTree, or nil if an error occurred. -- (nullable GTTree *)writeTree:(NSError **)error; +- (GTTree * _Nullable)writeTree:(NSError **)error; /// Write the index to the given repository as a tree. /// Will fail if the receiver's index has conflicts. @@ -188,7 +188,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - The error if one occurred. /// /// Returns a new GTTree or nil if an error occurred. -- (nullable GTTree *)writeTreeToRepository:(GTRepository *)repository error:(NSError **)error; +- (GTTree * _Nullable)writeTreeToRepository:(GTRepository *)repository error:(NSError **)error; /// Enumerate through any conflicts in the index, running the provided block each /// time. @@ -220,11 +220,11 @@ NS_ASSUME_NONNULL_BEGIN /// error - When something goes wrong, this parameter is set. Optional. /// /// Returns `YES` in the event that everything has gone smoothly. Otherwise, `NO`. -- (BOOL)updatePathspecs:(nullable NSArray *)pathspecs error:(NSError **)error passingTest:(nullable BOOL (^)(NSString *matchedPathspec, NSString *path, BOOL *stop))block; +- (BOOL)updatePathspecs:(NSArray * _Nullable)pathspecs error:(NSError **)error passingTest:(BOOL (^ _Nullable)(NSString *matchedPathspec, NSString *path, BOOL *stop))block; #pragma mark Deprecations -- (nullable GTIndexEntry *)entryWithName:(NSString *)name __deprecated_msg("use entryWithPath: instead."); -- (nullable GTIndexEntry *)entryWithName:(NSString *)name error:(NSError **)error __deprecated_msg("use entryWithPath:error: instead."); +- (GTIndexEntry * _Nullable)entryWithName:(NSString *)name __deprecated_msg("use entryWithPath: instead."); +- (GTIndexEntry * _Nullable)entryWithName:(NSString *)name error:(NSError **)error __deprecated_msg("use entryWithPath:error: instead."); @end diff --git a/ObjectiveGit/GTIndexEntry.h b/ObjectiveGit/GTIndexEntry.h index 8b5ff9f23..1e2f26d33 100644 --- a/ObjectiveGit/GTIndexEntry.h +++ b/ObjectiveGit/GTIndexEntry.h @@ -54,14 +54,14 @@ NS_ASSUME_NONNULL_BEGIN /// error - will be filled if an error occurs /// /// Returns the initialized object. -- (instancetype)initWithGitIndexEntry:(const git_index_entry *)entry index:(nullable GTIndex *)index error:(NSError **)error NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithGitIndexEntry:(const git_index_entry *)entry index:(GTIndex * _Nullable)index error:(NSError **)error NS_DESIGNATED_INITIALIZER; - (instancetype)initWithGitIndexEntry:(const git_index_entry *)entry; /// The underlying `git_index_entry` object. - (const git_index_entry *)git_index_entry __attribute__((objc_returns_inner_pointer)); /// The entry's index. This may be nil if nil is passed in to -initWithGitIndexEntry: -@property (nonatomic, strong, readonly, nullable) GTIndex *index; +@property (nonatomic, strong, readonly) GTIndex * _Nullable index; /// The repository-relative path for the entry. @property (nonatomic, readonly, copy) NSString *path; @@ -86,8 +86,8 @@ NS_ASSUME_NONNULL_BEGIN @interface GTObject (GTIndexEntry) -+ (nullable instancetype)objectWithIndexEntry:(GTIndexEntry *)indexEntry error:(NSError **)error; -- (nullable instancetype)initWithIndexEntry:(GTIndexEntry *)indexEntry error:(NSError **)error; ++ (instancetype _Nullable)objectWithIndexEntry:(GTIndexEntry *)indexEntry error:(NSError **)error; +- (instancetype _Nullable)initWithIndexEntry:(GTIndexEntry *)indexEntry error:(NSError **)error; @end diff --git a/ObjectiveGit/GTNote.h b/ObjectiveGit/GTNote.h index 509a2bbd1..01955057f 100644 --- a/ObjectiveGit/GTNote.h +++ b/ObjectiveGit/GTNote.h @@ -40,10 +40,10 @@ NS_ASSUME_NONNULL_BEGIN @interface GTNote : NSObject {} /// The author of the note. -@property (nonatomic, readonly, strong, nullable) GTSignature *author; +@property (nonatomic, readonly, strong) GTSignature * _Nullable author; /// The committer of the note. -@property (nonatomic, readonly, strong, nullable) GTSignature *committer; +@property (nonatomic, readonly, strong) GTSignature * _Nullable committer; /// Content of the note. @property (nonatomic, readonly, strong) NSString *note; @@ -62,7 +62,7 @@ NS_ASSUME_NONNULL_BEGIN /// May be NULL. /// /// Returns initialized GTNote instance or nil on failure (error will be populated, if passed). -- (nullable instancetype)initWithTargetOID:(GTOID *)oid repository:(GTRepository *)repository referenceName:(nullable NSString *)referenceName error:(NSError **)error; +- (instancetype _Nullable)initWithTargetOID:(GTOID *)oid repository:(GTRepository *)repository referenceName:(NSString * _Nullable)referenceName error:(NSError **)error; /// Create a note with target libgit2 oid in the given repository. /// @@ -71,7 +71,7 @@ NS_ASSUME_NONNULL_BEGIN /// referenceName - Name for the notes reference in the repo, or NULL for default ("refs/notes/commits") /// /// Returns initialized GTNote instance or nil on failure. -- (nullable instancetype)initWithTargetGitOID:(git_oid *)oid repository:(git_repository *)repository referenceName:(const char * _Nullable)referenceName error:(NSError **)error NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithTargetGitOID:(git_oid *)oid repository:(git_repository *)repository referenceName:(const char * _Nullable)referenceName error:(NSError **)error NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; @@ -83,7 +83,7 @@ NS_ASSUME_NONNULL_BEGIN /// May be NULL. /// /// Returns default reference name (usually "refs/notes/commits"). -+ (nullable NSString *)defaultReferenceNameForRepository:(GTRepository *)repository error:(NSError **)error; ++ (NSString * _Nullable)defaultReferenceNameForRepository:(GTRepository *)repository error:(NSError **)error; @end diff --git a/ObjectiveGit/GTOID.h b/ObjectiveGit/GTOID.h index 95bda1475..3291d920b 100644 --- a/ObjectiveGit/GTOID.h +++ b/ObjectiveGit/GTOID.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @interface GTOID : NSObject /// The SHA pointed to by the OID. -@property (nonatomic, readonly, copy, nullable) NSString *SHA; +@property (nonatomic, readonly, copy) NSString * _Nullable SHA; /// Is the OID all zero? This usually indicates that the object has not been /// inserted into the ODB yet. @@ -36,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN /// SHA - The to convert to an OID. Cannot be nil. /// /// Returns the initialized receiver. -- (nullable instancetype)initWithSHA:(NSString *)SHA; +- (instancetype _Nullable)initWithSHA:(NSString *)SHA; /// Initializes the receiver by converting the given SHA to an OID /// optionally returning a NSError instance on failure. @@ -45,14 +45,14 @@ NS_ASSUME_NONNULL_BEGIN /// error - Will be filled with an error object in if the SHA cannot be parsed /// /// Returns the initialized receiver or nil if an error occured. -- (nullable instancetype)initWithSHA:(NSString *)SHA error:(NSError **)error; +- (instancetype _Nullable)initWithSHA:(NSString *)SHA error:(NSError **)error; /// Initializes the receiver by converting the given SHA C string to an OID. /// /// string - The C string to convert. Cannot be NULL. /// /// Returns the initialized receiver. -- (nullable instancetype)initWithSHACString:(const char *)string; +- (instancetype _Nullable)initWithSHACString:(const char *)string; /// Initializes the receiver by converting the given SHA C string to an OID /// optionally returning a NSError instance on failure. @@ -61,16 +61,16 @@ NS_ASSUME_NONNULL_BEGIN /// error - Will be filled with an error object in if the SHA cannot be parsed /// /// Returns the initialized receiver. -- (nullable instancetype)initWithSHACString:(const char *)string error:(NSError **)error NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithSHACString:(const char *)string error:(NSError **)error NS_DESIGNATED_INITIALIZER; /// Creates a new instance with the given git_oid using initWithGitOid: + (instancetype)oidWithGitOid:(const git_oid *)git_oid; /// Creates a new instance from the given SHA string using initWithSHAString: -+ (nullable instancetype)oidWithSHA:(NSString *)SHA; ++ (instancetype _Nullable)oidWithSHA:(NSString *)SHA; /// Creates a new instance from the given SHA C string using initWithSHACString: -+ (nullable instancetype)oidWithSHACString:(const char *)SHA; ++ (instancetype _Nullable)oidWithSHACString:(const char *)SHA; /// Returns the underlying git_oid struct. - (const git_oid *)git_oid __attribute__((objc_returns_inner_pointer)); @@ -85,7 +85,7 @@ NS_ASSUME_NONNULL_BEGIN /// type - The type of the git object. /// /// Returns a new OID, or nil if an error occurred. -+ (nullable instancetype)OIDByHashingData:(NSData *)data type:(GTObjectType)type error:(NSError **)error; ++ (instancetype _Nullable)OIDByHashingData:(NSData *)data type:(GTObjectType)type error:(NSError **)error; @end diff --git a/ObjectiveGit/GTObject.h b/ObjectiveGit/GTObject.h index c39abd37b..a66e02b99 100644 --- a/ObjectiveGit/GTObject.h +++ b/ObjectiveGit/GTObject.h @@ -52,18 +52,18 @@ NS_ASSUME_NONNULL_BEGIN @interface GTObject : NSObject @property (nonatomic, readonly) NSString *type; -@property (nonatomic, readonly, nullable) NSString *SHA; -@property (nonatomic, readonly, nullable) NSString *shortSHA; +@property (nonatomic, readonly) NSString * _Nullable SHA; +@property (nonatomic, readonly) NSString * _Nullable shortSHA; @property (nonatomic, readonly, strong) GTRepository *repository; -@property (nonatomic, readonly, nullable) GTOID *OID; +@property (nonatomic, readonly) GTOID * _Nullable OID; - (instancetype)init NS_UNAVAILABLE; /// Designated initializer. -- (nullable id)initWithObj:(git_object *)theObject inRepository:(GTRepository *)theRepo NS_DESIGNATED_INITIALIZER; +- (id _Nullable)initWithObj:(git_object *)theObject inRepository:(GTRepository *)theRepo NS_DESIGNATED_INITIALIZER; /// Class convenience initializer -+ (nullable id)objectWithObj:(git_object *)theObject inRepository:(GTRepository *)theRepo; ++ (id _Nullable)objectWithObj:(git_object *)theObject inRepository:(GTRepository *)theRepo; /// The underlying `git_object`. - (git_object *)git_object __attribute__((objc_returns_inner_pointer)); @@ -73,7 +73,7 @@ NS_ASSUME_NONNULL_BEGIN /// error(out) - will be filled if an error occurs /// /// returns a GTOdbObject or nil if an error occurred. -- (nullable GTOdbObject *)odbObjectWithError:(NSError **)error; +- (GTOdbObject * _Nullable)odbObjectWithError:(NSError **)error; /// Recursively peel an object until an object of the specified type is met. /// @@ -84,7 +84,7 @@ NS_ASSUME_NONNULL_BEGIN /// May be NULL. /// /// Returns the found object or nil on error. -- (nullable id)objectByPeelingToType:(GTObjectType)type error:(NSError **)error; +- (id _Nullable)objectByPeelingToType:(GTObjectType)type error:(NSError **)error; @end diff --git a/ObjectiveGit/GTObjectDatabase.h b/ObjectiveGit/GTObjectDatabase.h index 14cad11d5..c111d8b6a 100644 --- a/ObjectiveGit/GTObjectDatabase.h +++ b/ObjectiveGit/GTObjectDatabase.h @@ -42,13 +42,13 @@ NS_ASSUME_NONNULL_BEGIN /// error - The error if one occurred. /// /// Returns the initialized object. -- (nullable instancetype)initWithRepository:(GTRepository *)repo error:(NSError **)error NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithRepository:(GTRepository *)repo error:(NSError **)error NS_DESIGNATED_INITIALIZER; /// The underlying `git_odb` object. - (git_odb *)git_odb __attribute__((objc_returns_inner_pointer)); -- (nullable GTOdbObject *)objectWithOID:(GTOID *)OID error:(NSError **)error; -- (nullable GTOdbObject *)objectWithSHA:(NSString *)SHA error:(NSError **)error; +- (GTOdbObject * _Nullable)objectWithOID:(GTOID *)OID error:(NSError **)error; +- (GTOdbObject * _Nullable)objectWithSHA:(NSString *)SHA error:(NSError **)error; /// Writes the data into the object database. /// @@ -58,7 +58,7 @@ NS_ASSUME_NONNULL_BEGIN /// /// Returns the OID for the object which was written, or nil if an error /// occurred. -- (nullable GTOID *)writeData:(NSData *)data type:(GTObjectType)type error:(NSError **)error; +- (GTOID * _Nullable)writeData:(NSData *)data type:(GTObjectType)type error:(NSError **)error; - (BOOL)containsObjectWithSHA:(NSString *)SHA error:(NSError **)error; diff --git a/ObjectiveGit/GTOdbObject.h b/ObjectiveGit/GTOdbObject.h index 8add7d39f..389bce721 100644 --- a/ObjectiveGit/GTOdbObject.h +++ b/ObjectiveGit/GTOdbObject.h @@ -23,18 +23,18 @@ NS_ASSUME_NONNULL_BEGIN /// repository - The repository in which the object resides. Cannot be nil. /// /// Returns the initialized object. -- (nullable instancetype)initWithOdbObj:(git_odb_object *)object repository:(GTRepository *)repository NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithOdbObj:(git_odb_object *)object repository:(GTRepository *)repository NS_DESIGNATED_INITIALIZER; /// The underlying `git_odb_object`. - (git_odb_object *)git_odb_object __attribute__((objc_returns_inner_pointer)); -- (nullable NSString *)shaHash; +- (NSString * _Nullable)shaHash; - (GTObjectType)type; - (size_t)length; -- (nullable NSData *)data; +- (NSData * _Nullable)data; /// The object ID of this object. -@property (nonatomic, readonly, nullable) GTOID *OID; +@property (nonatomic, readonly) GTOID * _Nullable OID; @end diff --git a/ObjectiveGit/GTReference.h b/ObjectiveGit/GTReference.h index e9e0db1d4..cc36b8d70 100644 --- a/ObjectiveGit/GTReference.h +++ b/ObjectiveGit/GTReference.h @@ -52,7 +52,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly, strong) GTRepository *repository; @property (nonatomic, readonly) GTReferenceType referenceType; @property (nonatomic, readonly) const git_oid *git_oid; -@property (nonatomic, strong, readonly, nullable) GTOID *OID; +@property (nonatomic, strong, readonly) GTOID * _Nullable OID; /// Whether this is a remote-tracking branch. @property (nonatomic, readonly, getter = isRemote) BOOL remote; @@ -61,8 +61,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly, strong) GTReflog *reflog; /// Convenience initializers -+ (nullable instancetype)referenceByResolvingSymbolicReference:(GTReference *)symbolicRef error:(NSError **)error; -- (nullable instancetype)initByResolvingSymbolicReference:(GTReference *)symbolicRef error:(NSError **)error; ++ (instancetype _Nullable)referenceByResolvingSymbolicReference:(GTReference *)symbolicRef error:(NSError **)error; +- (instancetype _Nullable)initByResolvingSymbolicReference:(GTReference *)symbolicRef error:(NSError **)error; - (instancetype)init NS_UNAVAILABLE; @@ -72,16 +72,16 @@ NS_ASSUME_NONNULL_BEGIN /// repository - The repository containing the reference. Must not be nil. /// /// Returns the initialized receiver. -- (nullable instancetype)initWithGitReference:(git_reference *)ref repository:(GTRepository *)repository NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithGitReference:(git_reference *)ref repository:(GTRepository *)repository NS_DESIGNATED_INITIALIZER; /// The underlying `git_reference` object. - (git_reference *)git_reference __attribute__((objc_returns_inner_pointer)); /// The target (either GTObject or GTReference) to which the reference points. -@property (nonatomic, readonly, copy, nullable) id unresolvedTarget; +@property (nonatomic, readonly, copy) id _Nullable unresolvedTarget; /// The resolved object to which the reference points. -@property (nonatomic, readonly, copy, nullable) id resolvedTarget; +@property (nonatomic, readonly, copy) id _Nullable resolvedTarget; /// The last direct reference in a chain @property (nonatomic, readonly, copy) GTReference *resolvedReference; @@ -100,10 +100,10 @@ NS_ASSUME_NONNULL_BEGIN /// error - The error if one occurred. /// /// Returns the updated reference, or nil if an error occurred. -- (nullable GTReference *)referenceByUpdatingTarget:(NSString *)newTarget message:(nullable NSString *)message error:(NSError **)error; +- (GTReference * _Nullable)referenceByUpdatingTarget:(NSString *)newTarget message:(NSString * _Nullable)message error:(NSError **)error; /// The name of the reference. -@property (nonatomic, readonly, copy, nullable) NSString *name; +@property (nonatomic, readonly, copy) NSString * _Nullable name; /// Updates the on-disk reference to the name and returns the renamed reference. /// @@ -113,7 +113,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - The error if one occurred. /// /// Returns the renamed reference, or nil if an error occurred. -- (nullable GTReference *)referenceByRenaming:(NSString *)newName error:(NSError **)error; +- (GTReference * _Nullable)referenceByRenaming:(NSString *)newName error:(NSError **)error; /// Delete this reference. /// @@ -127,14 +127,14 @@ NS_ASSUME_NONNULL_BEGIN /// error(out) - will be filled if an error occurs /// /// returns the peeled GTReference or nil if an error occurred. -- (nullable GTReference *)resolvedReferenceWithError:(NSError **)error; +- (GTReference * _Nullable)resolvedReferenceWithError:(NSError **)error; /// Reload the reference from disk. /// /// error - The error if one occurred. /// /// Returns the reloaded reference, or nil if an error occurred. -- (nullable GTReference *)reloadedReferenceWithError:(NSError **)error; +- (GTReference * _Nullable)reloadedReferenceWithError:(NSError **)error; /// An error indicating that the git_reference is no longer valid. + (NSError *)invalidReferenceError; diff --git a/ObjectiveGit/GTReflog+Private.h b/ObjectiveGit/GTReflog+Private.h index cf21c00fe..812cad515 100644 --- a/ObjectiveGit/GTReflog+Private.h +++ b/ObjectiveGit/GTReflog+Private.h @@ -10,6 +10,6 @@ @interface GTReflog () -- (nullable instancetype)init NS_UNAVAILABLE; +- (instancetype _Nullable)init NS_UNAVAILABLE; @end diff --git a/ObjectiveGit/GTReflog.h b/ObjectiveGit/GTReflog.h index 581300f53..feeafea51 100644 --- a/ObjectiveGit/GTReflog.h +++ b/ObjectiveGit/GTReflog.h @@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN /// reference - The reference whose reflog is being represented. Cannot be nil. /// /// Returns the initialized object. -- (nullable instancetype)initWithReference:(nonnull GTReference *)reference NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithReference:(GTReference * _Nonnull)reference NS_DESIGNATED_INITIALIZER; /// Writes a new entry to the reflog. /// @@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN /// than `entryCount`, it will assert. /// /// Returns the entry at that index or nil if not found. -- (nullable GTReflogEntry *)entryAtIndex:(NSUInteger)index; +- (GTReflogEntry * _Nullable)entryAtIndex:(NSUInteger)index; @end diff --git a/ObjectiveGit/GTReflogEntry+Private.h b/ObjectiveGit/GTReflogEntry+Private.h index 8105bab5a..b30415160 100644 --- a/ObjectiveGit/GTReflogEntry+Private.h +++ b/ObjectiveGit/GTReflogEntry+Private.h @@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN /// reflog - The reflog in which the entry resides. Cannot be nil. /// /// Returns the initialized object. -- (nullable instancetype)initWithGitReflogEntry:(const git_reflog_entry *)entry reflog:(GTReflog *)reflog NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithGitReflogEntry:(const git_reflog_entry *)entry reflog:(GTReflog *)reflog NS_DESIGNATED_INITIALIZER; @end diff --git a/ObjectiveGit/GTReflogEntry.h b/ObjectiveGit/GTReflogEntry.h index c3e08468c..99fcc503f 100644 --- a/ObjectiveGit/GTReflogEntry.h +++ b/ObjectiveGit/GTReflogEntry.h @@ -15,15 +15,15 @@ @interface GTReflogEntry : NSObject /// The OID of the ref before the entry. -@property (nonatomic, readonly, strong, nullable) GTOID *previousOID; +@property (nonatomic, readonly, strong) GTOID * _Nullable previousOID; /// The OID of the ref when the entry was made. -@property (nonatomic, readonly, strong, nullable) GTOID *updatedOID; +@property (nonatomic, readonly, strong) GTOID * _Nullable updatedOID; /// The person who committed the entry. -@property (nonatomic, readonly, strong, nullable) GTSignature *committer; +@property (nonatomic, readonly, strong) GTSignature * _Nullable committer; /// The message associated with the entry. -@property (nonatomic, readonly, copy, nullable) NSString *message; +@property (nonatomic, readonly, copy) NSString * _Nullable message; @end diff --git a/ObjectiveGit/GTRemote.h b/ObjectiveGit/GTRemote.h index 78cbfc386..bde9a37f1 100644 --- a/ObjectiveGit/GTRemote.h +++ b/ObjectiveGit/GTRemote.h @@ -34,13 +34,13 @@ typedef enum { @property (nonatomic, readonly, strong) GTRepository *repository; /// The name of the remote. -@property (nonatomic, readonly, copy, nullable) NSString *name; +@property (nonatomic, readonly, copy) NSString * _Nullable name; /// The URL string for the remote. -@property (nonatomic, readonly, copy, nullable) NSString *URLString; +@property (nonatomic, readonly, copy) NSString * _Nullable URLString; /// The push URL for the remote, if provided. -@property (nonatomic, copy, nullable) NSString *pushURLString; +@property (nonatomic, copy) NSString * _Nullable pushURLString; /// Whether the remote is connected or not. @property (nonatomic, readonly, getter=isConnected) BOOL connected; @@ -56,13 +56,13 @@ typedef enum { /// /// This array will contain NSStrings of the form /// `+refs/heads/*:refs/remotes/REMOTE/*`. -@property (nonatomic, readonly, copy, nullable) NSArray *fetchRefspecs; +@property (nonatomic, readonly, copy) NSArray * _Nullable fetchRefspecs; /// The push refspecs for this remote. /// /// This array will contain NSStrings of the form /// `+refs/heads/*:refs/remotes/REMOTE/*`. -@property (nonatomic, readonly, copy, nullable) NSArray *pushRefspecs; +@property (nonatomic, readonly, copy) NSArray * _Nullable pushRefspecs; /// Tests if a name is valid + (BOOL)isValidRemoteName:(NSString *)name; @@ -75,7 +75,7 @@ typedef enum { /// error - Will be set if an error occurs. /// /// Returns a new remote, or nil if an error occurred -+ (nullable instancetype)createRemoteWithName:(NSString *)name URLString:(NSString *)URLString inRepository:(GTRepository *)repo error:(NSError **)error; ++ (instancetype _Nullable)createRemoteWithName:(NSString *)name URLString:(NSString *)URLString inRepository:(GTRepository *)repo error:(NSError **)error; /// Load a remote from a repository. /// @@ -84,7 +84,7 @@ typedef enum { /// error - Will be set if an error occurs. /// /// Returns the loaded remote, or nil if an error occurred. -+ (nullable instancetype)remoteWithName:(NSString *)name inRepository:(GTRepository *)repo error:(NSError **)error; ++ (instancetype _Nullable)remoteWithName:(NSString *)name inRepository:(GTRepository *)repo error:(NSError **)error; - (instancetype)init NS_UNAVAILABLE; @@ -94,7 +94,7 @@ typedef enum { /// repo - The repository the remote belongs to. Cannot be nil. /// /// Returns the initialized receiver, or nil if an error occurred. -- (nullable instancetype)initWithGitRemote:(git_remote *)remote inRepository:(GTRepository *)repo NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithGitRemote:(git_remote *)remote inRepository:(GTRepository *)repo NS_DESIGNATED_INITIALIZER; /// The underlying `git_remote` object. - (git_remote *)git_remote __attribute__((objc_returns_inner_pointer)); diff --git a/ObjectiveGit/GTRepository+Attributes.h b/ObjectiveGit/GTRepository+Attributes.h index 75cdaed30..a86ab6e28 100644 --- a/ObjectiveGit/GTRepository+Attributes.h +++ b/ObjectiveGit/GTRepository+Attributes.h @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN /// path - The path to use for the lookup. Cannot be nil. /// /// Returns the value of the attribute or nil. -- (nullable NSString *)attributeWithName:(NSString *)name path:(NSString *)path; +- (NSString * _Nullable)attributeWithName:(NSString *)name path:(NSString *)path; @end diff --git a/ObjectiveGit/GTRepository+Committing.h b/ObjectiveGit/GTRepository+Committing.h index e77ee2115..4e5518664 100644 --- a/ObjectiveGit/GTRepository+Committing.h +++ b/ObjectiveGit/GTRepository+Committing.h @@ -25,11 +25,11 @@ NS_ASSUME_NONNULL_BEGIN /// error - The error if one occurred. /// /// Returns the newly created commit, or nil if an error occurred. -- (nullable GTCommit *)createCommitWithTree:(GTTree *)tree message:(NSString *)message author:(GTSignature *)author committer:(GTSignature *)committer parents:(nullable NSArray *)parents updatingReferenceNamed:(nullable NSString *)refName error:(NSError **)error; +- (GTCommit * _Nullable)createCommitWithTree:(GTTree *)tree message:(NSString *)message author:(GTSignature *)author committer:(GTSignature *)committer parents:(NSArray * _Nullable)parents updatingReferenceNamed:(NSString * _Nullable)refName error:(NSError **)error; /// Creates a new commit using +createCommitWithTree:message:author:committer:parents:updatingReferenceNamed:error: /// with -userSignatureForNow as both the author and committer. -- (nullable GTCommit *)createCommitWithTree:(GTTree *)tree message:(NSString *)message parents:(nullable NSArray *)parents updatingReferenceNamed:(nullable NSString *)refName error:(NSError **)error; +- (GTCommit * _Nullable)createCommitWithTree:(GTTree *)tree message:(NSString *)message parents:(NSArray * _Nullable)parents updatingReferenceNamed:(NSString * _Nullable)refName error:(NSError **)error; @end diff --git a/ObjectiveGit/GTRepository+Private.h b/ObjectiveGit/GTRepository+Private.h index 194c3dc7f..f3341730c 100644 --- a/ObjectiveGit/GTRepository+Private.h +++ b/ObjectiveGit/GTRepository+Private.h @@ -12,8 +12,8 @@ NS_ASSUME_NONNULL_BEGIN @interface GTRepository () -- (nullable id)lookUpObjectByGitOid:(const git_oid *)oid objectType:(GTObjectType)type error:(NSError **)error; -- (nullable id)lookUpObjectByGitOid:(const git_oid *)oid error:(NSError **)error; +- (id _Nullable)lookUpObjectByGitOid:(const git_oid *)oid objectType:(GTObjectType)type error:(NSError **)error; +- (id _Nullable)lookUpObjectByGitOid:(const git_oid *)oid error:(NSError **)error; @end diff --git a/ObjectiveGit/GTRepository+Pull.h b/ObjectiveGit/GTRepository+Pull.h index 8af3b1cd7..cbc1f74fd 100644 --- a/ObjectiveGit/GTRepository+Pull.h +++ b/ObjectiveGit/GTRepository+Pull.h @@ -30,7 +30,7 @@ typedef void (^GTRemoteFetchTransferProgressBlock)(const git_transfer_progress * /// /// Returns YES if the pull was successful, NO otherwise (and `error`, if provided, /// will point to an error describing what happened). -- (BOOL)pullBranch:(GTBranch *)branch fromRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options error:(NSError **)error progress:(nullable GTRemoteFetchTransferProgressBlock)progressBlock; +- (BOOL)pullBranch:(GTBranch *)branch fromRemote:(GTRemote *)remote withOptions:(NSDictionary * _Nullable)options error:(NSError **)error progress:(GTRemoteFetchTransferProgressBlock _Nullable)progressBlock; @end diff --git a/ObjectiveGit/GTRepository+References.h b/ObjectiveGit/GTRepository+References.h index 89ba93ca3..cfddac2fc 100644 --- a/ObjectiveGit/GTRepository+References.h +++ b/ObjectiveGit/GTRepository+References.h @@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - The error if one occurs. May be NULL. /// /// Returns the reference or nil if look up failed. -- (nullable GTReference *)lookUpReferenceWithName:(NSString *)name error:(NSError **)error; +- (GTReference * _Nullable)lookUpReferenceWithName:(NSString *)name error:(NSError **)error; @end diff --git a/ObjectiveGit/GTRepository+RemoteOperations.h b/ObjectiveGit/GTRepository+RemoteOperations.h index 86fbdfd0e..d93ebaad7 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.h +++ b/ObjectiveGit/GTRepository+RemoteOperations.h @@ -51,7 +51,7 @@ typedef NS_ENUM(NSInteger, GTFetchPruneOption) { /// /// Returns YES if the fetch was successful, NO otherwise (and `error`, if provided, /// will point to an error describing what happened). -- (BOOL)fetchRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options error:(NSError **)error progress:(nullable void (^)(const git_transfer_progress *stats, BOOL *stop))progressBlock; +- (BOOL)fetchRemote:(GTRemote *)remote withOptions:(NSDictionary * _Nullable)options error:(NSError **)error progress:(void (^ _Nullable)(const git_transfer_progress *stats, BOOL *stop))progressBlock; /// Enumerate all available fetch head entries. /// @@ -85,7 +85,7 @@ typedef NS_ENUM(NSInteger, GTFetchPruneOption) { /// /// Returns YES if the push was successful, NO otherwise (and `error`, if provided, /// will point to an error describing what happened). -- (BOOL)pushBranch:(GTBranch *)branch toRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options error:(NSError **)error progress:(nullable void (^)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop))progressBlock; +- (BOOL)pushBranch:(GTBranch *)branch toRemote:(GTRemote *)remote withOptions:(NSDictionary * _Nullable)options error:(NSError **)error progress:(void (^ _Nullable)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop))progressBlock; /// Push an array of branches to a remote. /// @@ -100,7 +100,7 @@ typedef NS_ENUM(NSInteger, GTFetchPruneOption) { /// /// Returns YES if the push was successful, NO otherwise (and `error`, if provided, /// will point to an error describing what happened). -- (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options error:(NSError **)error progress:(nullable void (^)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop))progressBlock; +- (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(NSDictionary * _Nullable)options error:(NSError **)error progress:(void (^ _Nullable)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop))progressBlock; /// Push a given Git notes reference name to a remote. /// @@ -114,7 +114,7 @@ typedef NS_ENUM(NSInteger, GTFetchPruneOption) { /// /// Returns YES if the push was successful, NO otherwise (and `error`, if provided, /// will point to an error describing what happened). -- (BOOL)pushNotes:(nullable NSString *)noteReferenceName toRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options error:(NSError **)error progress:(nullable void (^)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop))progressBlock; +- (BOOL)pushNotes:(NSString * _Nullable)noteReferenceName toRemote:(GTRemote *)remote withOptions:(NSDictionary * _Nullable)options error:(NSError **)error progress:(void (^ _Nullable)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop))progressBlock; /// Delete a remote branch /// @@ -127,7 +127,7 @@ typedef NS_ENUM(NSInteger, GTFetchPruneOption) { /// /// Returns YES if the push was successful, NO otherwise (and `error`, if provided, /// will point to an error describing what happened). -- (BOOL)deleteBranch:(GTBranch *)branch fromRemote:(GTRemote *)remote withOptions:(nullable NSDictionary *)options error:(NSError **)error; +- (BOOL)deleteBranch:(GTBranch *)branch fromRemote:(GTRemote *)remote withOptions:(NSDictionary * _Nullable)options error:(NSError **)error; @end NS_ASSUME_NONNULL_END diff --git a/ObjectiveGit/GTRepository+Stashing.h b/ObjectiveGit/GTRepository+Stashing.h index 364d8a720..a7dc57b34 100644 --- a/ObjectiveGit/GTRepository+Stashing.h +++ b/ObjectiveGit/GTRepository+Stashing.h @@ -53,14 +53,14 @@ NS_ASSUME_NONNULL_BEGIN /// /// Returns a commit representing the stashed changes if successful, or nil /// otherwise. -- (nullable GTCommit *)stashChangesWithMessage:(nullable NSString *)message flags:(GTRepositoryStashFlag)flags error:(NSError **)error; +- (GTCommit * _Nullable)stashChangesWithMessage:(NSString * _Nullable)message flags:(GTRepositoryStashFlag)flags error:(NSError **)error; /// Enumerate over all the stashes in the repository, from most recent to oldest. /// /// block - A block to execute for each stash found. `index` will be the zero-based /// stash index (where 0 is the most recent stash). Setting `stop` to YES /// will cause enumeration to stop after the block returns. Must not be nil. -- (void)enumerateStashesUsingBlock:(void (^)(NSUInteger index, NSString * __nullable message, GTOID * __nullable oid, BOOL *stop))block; +- (void)enumerateStashesUsingBlock:(void (^)(NSUInteger index, NSString * _Nullable message, GTOID * _Nullable oid, BOOL *stop))block; /// Apply stashed changes. /// @@ -71,7 +71,7 @@ NS_ASSUME_NONNULL_BEGIN /// progressBlock - A block that will be executed on each step of the stash application. /// /// Returns YES if the requested stash was successfully applied, NO otherwise. -- (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags checkoutOptions:(nullable GTCheckoutOptions *)options error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock; +- (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags checkoutOptions:(GTCheckoutOptions * _Nullable)options error:(NSError **)error progressBlock:(void (^ _Nullable)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock; /// Pop stashed changes. /// @@ -82,7 +82,7 @@ NS_ASSUME_NONNULL_BEGIN /// progressBlock - A block that will be executed on each step of the stash application. /// /// Returns YES if the requested stash was successfully applied, NO otherwise. -- (BOOL)popStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags checkoutOptions:(nullable GTCheckoutOptions *)options error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock; +- (BOOL)popStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags checkoutOptions:(GTCheckoutOptions * _Nullable)options error:(NSError **)error progressBlock:(void (^ _Nullable)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock; /// Drop a stash from the repository's list of stashes. /// diff --git a/ObjectiveGit/GTRepository+Stashing.m b/ObjectiveGit/GTRepository+Stashing.m index 981a53d6f..e5903a87f 100644 --- a/ObjectiveGit/GTRepository+Stashing.m +++ b/ObjectiveGit/GTRepository+Stashing.m @@ -26,13 +26,13 @@ - (GTCommit *)stashChangesWithMessage:(NSString *)message flags:(GTRepositorySta if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to stash."]; return nil; } - + return [self lookUpObjectByGitOid:&git_oid error:error]; } static int stashEnumerationCallback(size_t index, const char *message, const git_oid *stash_id, void *payload) { GTRepositoryStashEnumerationBlock block = (__bridge GTRepositoryStashEnumerationBlock)payload; - + NSString *messageString = nil; if (message != NULL) messageString = @(message); @@ -40,13 +40,13 @@ static int stashEnumerationCallback(size_t index, const char *message, const git BOOL stop = NO; block(index, messageString, stashOID, &stop); - + return (stop ? GIT_EUSER : 0); } - (void)enumerateStashesUsingBlock:(GTRepositoryStashEnumerationBlock)block { NSParameterAssert(block != nil); - + git_stash_foreach(self.git_repository, &stashEnumerationCallback, (__bridge void *)block); } @@ -59,11 +59,11 @@ static int stashApplyProgressCallback(git_stash_apply_progress_t progress, void return (stop ? GIT_EUSER : 0); } -- (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags checkoutOptions:(GTCheckoutOptions *)options error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock { +- (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags checkoutOptions:(GTCheckoutOptions *)options error:(NSError **)error progressBlock:(void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock { git_stash_apply_options stash_options = GIT_STASH_APPLY_OPTIONS_INIT; stash_options.flags = (git_stash_apply_flags)flags; - + if (progressBlock != nil) { stash_options.progress_cb = stashApplyProgressCallback; stash_options.progress_payload = (__bridge void *)progressBlock; @@ -81,7 +81,7 @@ - (BOOL)applyStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)fl return YES; } -- (BOOL)popStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags checkoutOptions:(GTCheckoutOptions *)options error:(NSError **)error progressBlock:(nullable void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock{ +- (BOOL)popStashAtIndex:(NSUInteger)index flags:(GTRepositoryStashApplyFlag)flags checkoutOptions:(GTCheckoutOptions *)options error:(NSError **)error progressBlock:(void (^)(GTRepositoryStashApplyProgress progress, BOOL *stop))progressBlock { git_stash_apply_options stash_options = GIT_STASH_APPLY_OPTIONS_INIT; stash_options.flags = (git_stash_apply_flags)flags; diff --git a/ObjectiveGit/GTRepository+Status.h b/ObjectiveGit/GTRepository+Status.h index be12965da..86d4121ca 100644 --- a/ObjectiveGit/GTRepository+Status.h +++ b/ObjectiveGit/GTRepository+Status.h @@ -113,7 +113,7 @@ extern NSString *const GTRepositoryStatusOptionsPathSpecArrayKey; /// /// Returns `NO` in case of a failure or `YES` if the enumeration completed /// successfully. -- (BOOL)enumerateFileStatusWithOptions:(nullable NSDictionary *)options error:(NSError **)error usingBlock:(nullable void (^)(GTStatusDelta * __nullable headToIndex, GTStatusDelta * __nullable indexToWorkingDirectory, BOOL *stop))block; +- (BOOL)enumerateFileStatusWithOptions:(NSDictionary * _Nullable)options error:(NSError **)error usingBlock:(void (^ _Nullable)(GTStatusDelta * _Nullable headToIndex, GTStatusDelta * _Nullable indexToWorkingDirectory, BOOL *stop))block; /// Query the status of one file /// @@ -122,7 +122,7 @@ extern NSString *const GTRepositoryStatusOptionsPathSpecArrayKey; /// error - If not nil, set to any error that occurs. /// /// Returns the combined GTFileStatusFlags for the file. -- (GTFileStatusFlags)statusForFile:(NSString *)filePath success:(nullable BOOL *)success error:(NSError **)error; +- (GTFileStatusFlags)statusForFile:(NSString *)filePath success:(BOOL * _Nullable)success error:(NSError **)error; /// Tests the ignore rules to see if the file should be considered as ignored. /// @@ -131,7 +131,7 @@ extern NSString *const GTRepositoryStatusOptionsPathSpecArrayKey; /// error - If not nil, set to any error that occurs. /// /// Returns YES if the file should be ignored; NO otherwise. -- (BOOL)shouldFileBeIgnored:(NSURL *)fileURL success:(nullable BOOL *)success error:(NSError **)error; +- (BOOL)shouldFileBeIgnored:(NSURL *)fileURL success:(BOOL * _Nullable)success error:(NSError **)error; /// An enum for use with shouldIgnoreFileURL:error: below typedef NS_ENUM(NSInteger, GTFileIgnoreState) { diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index d9b099800..1d1129a7a 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -154,9 +154,9 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// The file URL for the repository's working directory. /// Returns nil for a bare repository. -@property (nonatomic, readonly, strong, nullable) NSURL *fileURL; +@property (nonatomic, readonly, strong) NSURL * _Nullable fileURL; /// The file URL for the repository's .git directory. -@property (nonatomic, readonly, strong, nullable) NSURL *gitDirectoryURL; +@property (nonatomic, readonly, strong) NSURL * _Nullable gitDirectoryURL; /// Is this a bare repository (one without a working directory)? @property (nonatomic, readonly, getter = isBare) BOOL bare; @@ -178,7 +178,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error - The error if one occurs. /// /// Returns the initialized repository, or nil if an error occurred. -+ (nullable instancetype)initializeEmptyRepositoryAtFileURL:(NSURL *)fileURL options:(nullable NSDictionary *)options error:(NSError **)error; ++ (instancetype _Nullable)initializeEmptyRepositoryAtFileURL:(NSURL *)fileURL options:(NSDictionary * _Nullable)options error:(NSError **)error; /// Convenience class initializer which uses the default options. /// @@ -186,7 +186,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error - The error if one occurs. /// /// Returns the initialized repository, or nil if an error occurred. -+ (nullable instancetype)repositoryWithURL:(NSURL *)localFileURL error:(NSError **)error; ++ (instancetype _Nullable)repositoryWithURL:(NSURL *)localFileURL error:(NSError **)error; /// Convenience initializer which uses the default options. /// @@ -194,7 +194,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error - The error if one occurs. /// /// Returns the initialized repository, or nil if an error occurred. -- (nullable instancetype)initWithURL:(NSURL *)localFileURL error:(NSError **)error; +- (instancetype _Nullable)initWithURL:(NSURL *)localFileURL error:(NSError **)error; /// Convenience initializer to find and open a repository with extended controls. /// @@ -205,7 +205,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error - The error if one occurs. /// /// Returns the initialized repository, or nil if an error occurred. -- (nullable instancetype)initWithURL:(NSURL *)localFileURL flags:(NSInteger)flags ceilingDirs:(nullable NSArray *)ceilingDirURLs error:(NSError **)error; +- (instancetype _Nullable)initWithURL:(NSURL *)localFileURL flags:(NSInteger)flags ceilingDirs:(NSArray * _Nullable)ceilingDirURLs error:(NSError **)error; - (instancetype)init NS_UNAVAILABLE; @@ -216,7 +216,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// after this method is invoked. This must not be nil. /// /// Returns an initialized GTRepository, or nil if an erroe occurred. -- (nullable instancetype)initWithGitRepository:(git_repository *)repository NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithGitRepository:(git_repository *)repository NS_DESIGNATED_INITIALIZER; /// The underlying `git_repository` object. - (git_repository *)git_repository __attribute__((objc_returns_inner_pointer)); @@ -239,16 +239,16 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// May be NULL. /// /// returns nil (and fills the error parameter) if an error occurred, or a GTRepository object if successful. -+ (nullable instancetype)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(nullable NSDictionary *)options error:(NSError **)error transferProgressBlock:(nullable void (^)(const git_transfer_progress *, BOOL *stop))transferProgressBlock; ++ (instancetype _Nullable)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(NSDictionary * _Nullable)options error:(NSError **)error transferProgressBlock:(void (^ _Nullable)(const git_transfer_progress *, BOOL *stop))transferProgressBlock; /// Lookup objects in the repo by oid or sha1 -- (nullable id)lookUpObjectByOID:(GTOID *)oid objectType:(GTObjectType)type error:(NSError **)error; -- (nullable id)lookUpObjectByOID:(GTOID *)oid error:(NSError **)error; -- (nullable id)lookUpObjectBySHA:(NSString *)sha objectType:(GTObjectType)type error:(NSError **)error; -- (nullable id)lookUpObjectBySHA:(NSString *)sha error:(NSError **)error; +- (id _Nullable)lookUpObjectByOID:(GTOID *)oid objectType:(GTObjectType)type error:(NSError **)error; +- (id _Nullable)lookUpObjectByOID:(GTOID *)oid error:(NSError **)error; +- (id _Nullable)lookUpObjectBySHA:(NSString *)sha objectType:(GTObjectType)type error:(NSError **)error; +- (id _Nullable)lookUpObjectBySHA:(NSString *)sha error:(NSError **)error; /// Lookup an object in the repo using a revparse spec -- (nullable id)lookUpObjectByRevParse:(NSString *)spec error:(NSError **)error; +- (id _Nullable)lookUpObjectByRevParse:(NSString *)spec error:(NSError **)error; /// Finds the branch with the given name and type. /// @@ -262,7 +262,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// /// Returns the matching branch, or nil if no match was found or an error occurs. /// The latter two cases can be distinguished by checking `success`. -- (nullable GTBranch *)lookUpBranchWithName:(NSString *)branchName type:(GTBranchType)branchType success:(nullable BOOL *)success error:(NSError **)error; +- (GTBranch * _Nullable)lookUpBranchWithName:(NSString *)branchName type:(GTBranchType)branchType success:(BOOL * _Nullable)success error:(NSError **)error; /// List all references in the repository /// @@ -271,14 +271,14 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// /// returns an array of NSStrings holding the names of the references /// returns nil if an error occurred and fills the error parameter -- (nullable NSArray *)referenceNamesWithError:(NSError **)error; +- (NSArray * _Nullable)referenceNamesWithError:(NSError **)error; /// Get the HEAD reference. /// /// error - If not NULL, set to any error that occurs. /// /// Returns a GTReference or nil if an error occurs. -- (nullable GTReference *)headReferenceWithError:(NSError **)error; +- (GTReference * _Nullable)headReferenceWithError:(NSError **)error; /// Move HEAD reference safely, since deleting and recreating HEAD is always wrong. /// @@ -301,14 +301,14 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error - If not NULL, set to any error that occurs. /// /// Returns an array of GTBranches or nil if an error occurs. -- (nullable NSArray *)localBranchesWithError:(NSError **)error; +- (NSArray * _Nullable)localBranchesWithError:(NSError **)error; /// Get the remote branches. /// /// error - If not NULL, set to any error that occurs. /// /// Returns an array of GTBranches or nil if an error occurs. -- (nullable NSArray *)remoteBranchesWithError:(NSError **)error; +- (NSArray * _Nullable)remoteBranchesWithError:(NSError **)error; /// Get branches with names sharing a given prefix. /// @@ -316,7 +316,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error - If not NULL, set to any error that occurs. /// /// Returns an array of GTBranches or nil if an error occurs. -- (nullable NSArray *)branchesWithPrefix:(NSString *)prefix error:(NSError **)error; +- (NSArray * _Nullable)branchesWithPrefix:(NSString *)prefix error:(NSError **)error; /// Get the local and remote branches and merge them together by combining local /// branches with their remote branch, if they have one. @@ -324,21 +324,21 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error - If not NULL, set to any error that occurs. /// /// Returns an array of GTBranches or nil if an error occurs. -- (nullable NSArray *)branches:(NSError **)error; +- (NSArray * _Nullable)branches:(NSError **)error; /// List all remotes in the repository /// /// error - will be filled if an error occurs /// /// returns an array of NSStrings holding the names of the remotes, or nil if an error occurred -- (nullable NSArray *)remoteNamesWithError:(NSError **)error; +- (NSArray * _Nullable)remoteNamesWithError:(NSError **)error; /// Get all tags in the repository. /// /// error - If not NULL, set to any error that occurs. /// /// Returns an array of GTTag or nil if an error occurs. -- (nullable NSArray *)allTagsWithError:(NSError **)error; +- (NSArray * _Nullable)allTagsWithError:(NSError **)error; /// Count all commits in the current branch (HEAD) /// @@ -356,7 +356,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error - If not NULL, set to any error that occurs. /// /// Returns the created ref, or nil if an error occurred. -- (nullable GTReference *)createReferenceNamed:(NSString *)name fromOID:(GTOID *)targetOID message:(nullable NSString *)message error:(NSError **)error; +- (GTReference * _Nullable)createReferenceNamed:(NSString *)name fromOID:(GTOID *)targetOID message:(NSString * _Nullable)message error:(NSError **)error; /// Creates a symbolic reference to another ref. /// @@ -367,7 +367,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error - If not NULL, set to any error that occurs. /// /// Returns the created ref, or nil if an error occurred. -- (nullable GTReference *)createReferenceNamed:(NSString *)name fromReference:(GTReference *)targetRef message:(nullable NSString *)message error:(NSError **)error; +- (GTReference * _Nullable)createReferenceNamed:(NSString *)name fromReference:(GTReference *)targetRef message:(NSString * _Nullable)message error:(NSError **)error; /// Create a new local branch pointing to the given OID. /// @@ -379,14 +379,14 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error - If not NULL, set to any error that occurs. /// /// Returns the new branch, or nil if an error occurred. -- (nullable GTBranch *)createBranchNamed:(NSString *)name fromOID:(GTOID *)targetOID message:(nullable NSString *)message error:(NSError **)error; +- (GTBranch * _Nullable)createBranchNamed:(NSString *)name fromOID:(GTOID *)targetOID message:(NSString * _Nullable)message error:(NSError **)error; /// Get the current branch. /// /// error(out) - will be filled if an error occurs /// /// returns the current branch or nil if an error occurred. -- (nullable GTBranch *)currentBranchWithError:(NSError **)error; +- (GTBranch * _Nullable)currentBranchWithError:(NSError **)error; /// Find the commits that are on our local branch but not on the remote branch. /// @@ -394,7 +394,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error(out) - will be filled if an error occurs /// /// returns the local commits, an empty array if there is no remote branch, or nil if an error occurred -- (nullable NSArray *)localCommitsRelativeToRemoteBranch:(GTBranch *)remoteBranch error:(NSError **)error; +- (NSArray * _Nullable)localCommitsRelativeToRemoteBranch:(GTBranch *)remoteBranch error:(NSError **)error; /// Retrieves git's "prepared message" for the next commit, like the default /// message pre-filled when committing after a conflicting merge. @@ -403,7 +403,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// /// Returns the message from disk, or nil if no prepared message exists or an /// error occurred. -- (nullable NSString *)preparedMessageWithError:(NSError **)error; +- (NSString * _Nullable)preparedMessageWithError:(NSError **)error; /// The signature for the user at the current time, based on the repository and /// system configs. If the user's name or email have not been set, reasonable @@ -420,7 +420,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// `error` will contain the error information. Setting `stop` to YES /// will cause enumeration to stop after the block returns. This must /// not be nil. -- (void)enumerateSubmodulesRecursively:(BOOL)recursive usingBlock:(void (^)(GTSubmodule * __nullable submodule, NSError *error, BOOL *stop))block; +- (void)enumerateSubmodulesRecursively:(BOOL)recursive usingBlock:(void (^)(GTSubmodule * _Nullable submodule, NSError *error, BOOL *stop))block; /// Looks up the top-level submodule with the given name. This will not recurse /// into submodule repositories. @@ -430,7 +430,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// /// Returns the first submodule that matches the given name, or nil if an error /// occurred locating or instantiating the GTSubmodule. -- (nullable GTSubmodule *)submoduleWithName:(NSString *)name error:(NSError **)error; +- (GTSubmodule * _Nullable)submoduleWithName:(NSString *)name error:(NSError **)error; /// Finds the merge base between the commits pointed at by the given OIDs. /// @@ -439,28 +439,28 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error - If not NULL, set to any error that occurs. /// /// Returns the merge base, or nil if none is found or an error occurred. -- (nullable GTCommit *)mergeBaseBetweenFirstOID:(GTOID *)firstOID secondOID:(GTOID *)secondOID error:(NSError **)error; +- (GTCommit * _Nullable)mergeBaseBetweenFirstOID:(GTOID *)firstOID secondOID:(GTOID *)secondOID error:(NSError **)error; /// The object database backing the repository. /// /// error - The error if one occurred. /// /// Returns the object database, or nil if an error occurred. -- (nullable GTObjectDatabase *)objectDatabaseWithError:(NSError **)error; +- (GTObjectDatabase * _Nullable)objectDatabaseWithError:(NSError **)error; /// The configuration for the repository. /// /// error - The error if one occurred. /// /// Returns the configuration, or nil if an error occurred. -- (nullable GTConfiguration *)configurationWithError:(NSError **)error; +- (GTConfiguration * _Nullable)configurationWithError:(NSError **)error; /// The index for the repository. /// /// error - The error if one occurred. /// /// Returns the index, or nil if an error occurred. -- (nullable GTIndex *)indexWithError:(NSError **)error; +- (GTIndex * _Nullable)indexWithError:(NSError **)error; /// Creates a new lightweight tag in this repository. /// @@ -489,7 +489,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// May be NULL. /// /// Returns the object ID of the newly created tag or nil on error. -- (nullable GTOID *)OIDByCreatingTagNamed:(NSString *)tagName target:(GTObject *)theTarget tagger:(GTSignature *)theTagger message:(NSString *)theMessage error:(NSError **)error; +- (GTOID * _Nullable)OIDByCreatingTagNamed:(NSString *)tagName target:(GTObject *)theTarget tagger:(GTSignature *)theTagger message:(NSString *)theMessage error:(NSError **)error; /// Creates an annotated tag in this repo. Existing tags are not overwritten. /// @@ -505,7 +505,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// May be NULL. /// /// Returns the newly created tag or nil on error. -- (nullable GTTag *)createTagNamed:(NSString *)tagName target:(GTObject *)theTarget tagger:(GTSignature *)theTagger message:(NSString *)theMessage error:(NSError **)error; +- (GTTag * _Nullable)createTagNamed:(NSString *)tagName target:(GTObject *)theTarget tagger:(GTSignature *)theTagger message:(NSString *)theMessage error:(NSError **)error; /// Checkout a commit /// @@ -514,7 +514,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error - The error if one occurred. Can be NULL. /// /// Returns YES if operation was successful, NO otherwise -- (BOOL)checkoutCommit:(GTCommit *)targetCommit options:(nullable GTCheckoutOptions *)options error:(NSError **)error; +- (BOOL)checkoutCommit:(GTCommit *)targetCommit options:(GTCheckoutOptions * _Nullable)options error:(NSError **)error; /// Checkout a reference /// @@ -523,7 +523,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error - The error if one occurred. Can be NULL. /// /// Returns YES if operation was successful, NO otherwise -- (BOOL)checkoutReference:(GTReference *)targetReference options:(nullable GTCheckoutOptions *)options error:(NSError **)error; +- (BOOL)checkoutReference:(GTReference *)targetReference options:(GTCheckoutOptions * _Nullable)options error:(NSError **)error; /// Checkout an index /// @@ -532,7 +532,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error - The error if one occurred. Can be NULL. /// /// Returns YES if operation was successful, NO otherwise -- (BOOL)checkoutIndex:(GTIndex *)index options:(nullable GTCheckoutOptions *)options error:(NSError **)error; +- (BOOL)checkoutIndex:(GTIndex *)index options:(GTCheckoutOptions * _Nullable)options error:(NSError **)error; /// Checkout a tree /// @@ -542,7 +542,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// /// Returns YES if operation was successful, NO otherwise /// Note: this operation will NOT update HEAD to newly checked out tree. -- (BOOL)checkoutTree:(GTTree *)targetTree options:(nullable GTCheckoutOptions *)options error:(NSError **)error; +- (BOOL)checkoutTree:(GTTree *)targetTree options:(GTCheckoutOptions * _Nullable)options error:(NSError **)error; /// Flush the gitattributes cache. - (void)flushAttributesCache; @@ -565,7 +565,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// Returns the loaded filter list, or nil if an error occurs or there are no /// filters to apply to the given path. The latter two cases can be /// distinguished using the value of `success`. -- (nullable GTFilterList *)filterListWithPath:(NSString *)path blob:(nullable GTBlob *)blob mode:(GTFilterSourceMode)mode options:(GTFilterListOptions)options success:(nullable BOOL *)success error:(NSError **)error; +- (GTFilterList * _Nullable)filterListWithPath:(NSString *)path blob:(GTBlob * _Nullable)blob mode:(GTFilterSourceMode)mode options:(GTFilterListOptions)options success:(BOOL * _Nullable)success error:(NSError **)error; /// Calculates how far ahead/behind the commit represented by `headOID` is, /// relative to the commit represented by `baseOID`. @@ -587,7 +587,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error - The error if one occurred. /// /// Returns the enumerator or nil if an error occurred. -- (nullable GTEnumerator *)enumeratorForUniqueCommitsFromOID:(GTOID *)fromOID relativeToOID:(GTOID *)relativeOID error:(NSError **)error; +- (GTEnumerator * _Nullable)enumeratorForUniqueCommitsFromOID:(GTOID *)fromOID relativeToOID:(GTOID *)relativeOID error:(NSError **)error; /// Determines the status of a git repository--i.e., whether an operation /// (merge, cherry-pick, etc) is in progress. @@ -604,7 +604,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// error - The error if one occurred. /// /// Returns YES if operation was successful, NO otherwise -- (BOOL)cleanupStateWithError:(NSError **)error; +- (BOOL)cleanupStateWithError:(NSError * _Nullable __autoreleasing *)error; /// Creates a new note in this repo (using a default notes reference, e.g. "refs/notes/commits") /// @@ -620,7 +620,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// May be NULL. /// /// Returns the newly created note or nil on error. -- (nullable GTNote *)createNote:(NSString *)note target:(GTObject *)theTarget referenceName:(nullable NSString *)referenceName author:(GTSignature *)author committer:(GTSignature *)committer overwriteIfExists:(BOOL)overwrite error:(NSError **)error; +- (GTNote * _Nullable)createNote:(NSString *)note target:(GTObject *)theTarget referenceName:(NSString * _Nullable)referenceName author:(GTSignature *)author committer:(GTSignature *)committer overwriteIfExists:(BOOL)overwrite error:(NSError **)error; /// Removes a note attached to object in this repo /// @@ -634,7 +634,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// May be NULL. /// /// Returns the YES on success and NO on error. -- (BOOL)removeNoteFromObject:(GTObject *)parentObject referenceName:(nullable NSString *)referenceName author:(GTSignature *)author committer:(GTSignature *)committer error:(NSError **)error; +- (BOOL)removeNoteFromObject:(GTObject *)parentObject referenceName:(NSString * _Nullable)referenceName author:(GTSignature *)author committer:(GTSignature *)committer error:(NSError **)error; /// Enumerates through all stored notes in this repo /// @@ -646,7 +646,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) { /// If the block sets `stop` to YES, the iterator is finished. /// /// Returns YES on overall success or NO on error of any kind. -- (BOOL)enumerateNotesWithReferenceName:(nullable NSString *)referenceName error:(NSError **)error usingBlock:(void (^)(GTNote * __nullable note, GTObject * __nullable object, NSError * __nullable error, BOOL *stop))block; +- (BOOL)enumerateNotesWithReferenceName:(NSString * _Nullable)referenceName error:(NSError **)error usingBlock:(void (^)(GTNote * _Nullable note, GTObject * _Nullable object, NSError * _Nullable error, BOOL *stop))block; @end diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 1c4185ff5..3a916577d 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -242,7 +242,7 @@ static int remoteCreate(git_remote **remote, git_repository *repo, const char *n git_remote_callbacks remoteCallbacks; }; -+ (nullable instancetype)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(nullable NSDictionary *)options error:(NSError **)error transferProgressBlock:(nullable void (^)(const git_transfer_progress *, BOOL *stop))transferProgressBlock { ++ (instancetype _Nullable)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(nullable NSDictionary *)options error:(NSError **)error transferProgressBlock:(void (^ _Nullable)(const git_transfer_progress *, BOOL *stop))transferProgressBlock { git_clone_options cloneOptions = GIT_CLONE_OPTIONS_INIT; @@ -889,7 +889,7 @@ - (BOOL)calculateAhead:(size_t *)ahead behind:(size_t *)behind ofOID:(GTOID *)he return YES; } -- (nullable GTEnumerator *)enumeratorForUniqueCommitsFromOID:(GTOID *)fromOID relativeToOID:(GTOID *)relativeOID error:(NSError **)error { +- (GTEnumerator *)enumeratorForUniqueCommitsFromOID:(GTOID *)fromOID relativeToOID:(GTOID *)relativeOID error:(NSError **)error { NSParameterAssert(fromOID != nil); NSParameterAssert(relativeOID != nil); @@ -907,18 +907,18 @@ - (nullable GTEnumerator *)enumeratorForUniqueCommitsFromOID:(GTOID *)fromOID re - (BOOL)calculateState:(GTRepositoryStateType *)state withError:(NSError **)error { NSParameterAssert(state != NULL); - + int result = git_repository_state(self.git_repository); if (result < 0) { if (error != NULL) *error = [NSError git_errorFor:result description:@"Failed to calculate repository state"]; return NO; } - + *state = result; return YES; } -- (BOOL)cleanupStateWithError:(NSError * _Nullable __autoreleasing *)error { +- (BOOL)cleanupStateWithError:(NSError **)error { int errorCode = git_repository_state_cleanup(self.git_repository); if (errorCode != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:errorCode description:@"Failed to clean up repository state"]; @@ -930,14 +930,14 @@ - (BOOL)cleanupStateWithError:(NSError * _Nullable __autoreleasing *)error { - (GTNote *)createNote:(NSString *)note target:(GTObject *)theTarget referenceName:(NSString *)referenceName author:(GTSignature *)author committer:(GTSignature *)committer overwriteIfExists:(BOOL)overwrite error:(NSError **)error { git_oid oid; - + int gitError = git_note_create(&oid, self.git_repository, referenceName.UTF8String, author.git_signature, committer.git_signature, theTarget.OID.git_oid, [note UTF8String], overwrite ? 1 : 0); if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to create a note in repository"]; - + return nil; } - + return [[GTNote alloc] initWithTargetOID:theTarget.OID repository:self referenceName:referenceName error:error]; } @@ -947,48 +947,48 @@ - (BOOL)removeNoteFromObject:(GTObject *)parentObject referenceName:(NSString *) if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to delete note from %@", parentObject]; return NO; } - + return YES; } - (BOOL)enumerateNotesWithReferenceName:(NSString *)referenceName error:(NSError **)error usingBlock:(void (^)(GTNote *note, GTObject *object, NSError *error, BOOL *stop))block { git_note_iterator *iter = NULL; - + int gitError = git_note_iterator_new(&iter, self.git_repository, referenceName.UTF8String); - + if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to enumerate notes"]; return NO; } - + @onExit { git_note_iterator_free(iter); }; - + git_oid note_id; git_oid object_id; BOOL success = YES; int iterError = GIT_OK; - + while ((iterError = git_note_next(¬e_id, &object_id, iter)) == GIT_OK) { NSError *lookupErr = nil; - + GTNote *note = [[GTNote alloc] initWithTargetOID:[GTOID oidWithGitOid:&object_id] repository:self referenceName:referenceName error:&lookupErr]; GTObject *obj = nil; - + if (note != nil) obj = [self lookUpObjectByGitOid:&object_id error:&lookupErr]; - + BOOL stop = NO; block(note, obj, lookupErr, &stop); if (stop) { break; } } - + if (iterError != GIT_OK && iterError != GIT_ITEROVER) { if (error != NULL) *error = [NSError git_errorFor:iterError description:@"Iterator error"]; } - + return success; } diff --git a/ObjectiveGit/GTSignature.h b/ObjectiveGit/GTSignature.h index 910af1a5c..566fe1e8f 100644 --- a/ObjectiveGit/GTSignature.h +++ b/ObjectiveGit/GTSignature.h @@ -36,23 +36,23 @@ NS_ASSUME_NONNULL_BEGIN @interface GTSignature : NSObject /// The name of the person. -@property (nonatomic, readonly, copy, nullable) NSString *name; +@property (nonatomic, readonly, copy) NSString * _Nullable name; /// The email of the person. -@property (nonatomic, readonly, copy, nullable) NSString *email; +@property (nonatomic, readonly, copy) NSString * _Nullable email; /// The time when the action happened. -@property (nonatomic, readonly, strong, nullable) NSDate *time; +@property (nonatomic, readonly, strong) NSDate * _Nullable time; /// The time zone that `time` should be interpreted relative to. -@property (nonatomic, readonly, copy, nullable) NSTimeZone *timeZone; +@property (nonatomic, readonly, copy) NSTimeZone * _Nullable timeZone; /// Initializes the receiver with the given signature. /// /// git_signature - The signature to wrap. This must not be NULL. /// /// Returns an initialized GTSignature, or nil if an error occurs. -- (nullable instancetype)initWithGitSignature:(const git_signature *)git_signature; +- (instancetype _Nullable)initWithGitSignature:(const git_signature *)git_signature; /// Initializes the receiver with the given information. /// @@ -62,7 +62,7 @@ NS_ASSUME_NONNULL_BEGIN /// zone. This may be nil. /// /// Returns an initialized GTSignature, or nil if an error occurs. -- (nullable instancetype)initWithName:(NSString *)name email:(NSString *)email time:(nullable NSDate *)time; +- (instancetype _Nullable)initWithName:(NSString *)name email:(NSString *)email time:(NSDate * _Nullable)time; /// The underlying `git_signature` object. - (const git_signature *)git_signature __attribute__((objc_returns_inner_pointer)); diff --git a/ObjectiveGit/GTStatusDelta.h b/ObjectiveGit/GTStatusDelta.h index 433be3f3e..17299cba1 100644 --- a/ObjectiveGit/GTStatusDelta.h +++ b/ObjectiveGit/GTStatusDelta.h @@ -18,10 +18,10 @@ NS_ASSUME_NONNULL_BEGIN @interface GTStatusDelta : NSObject /// The file as it was prior to the change represented by this status delta. -@property (nonatomic, readonly, copy, nullable) GTDiffFile *oldFile; +@property (nonatomic, readonly, copy) GTDiffFile * _Nullable oldFile; /// The file after the change represented by this status delta -@property (nonatomic, readonly, copy, nullable) GTDiffFile *newFile __attribute__((ns_returns_not_retained)); +@property (nonatomic, readonly, copy) GTDiffFile * _Nullable newFile __attribute__((ns_returns_not_retained)); /// The status of the file. @property (nonatomic, readonly) GTDeltaType status; @@ -36,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init NS_UNAVAILABLE; /// Designated initializer. -- (nullable instancetype)initWithGitDiffDelta:(const git_diff_delta *)delta NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithGitDiffDelta:(const git_diff_delta *)delta NS_DESIGNATED_INITIALIZER; @end diff --git a/ObjectiveGit/GTSubmodule.h b/ObjectiveGit/GTSubmodule.h index dcade76fb..eabc37698 100644 --- a/ObjectiveGit/GTSubmodule.h +++ b/ObjectiveGit/GTSubmodule.h @@ -65,28 +65,28 @@ NS_ASSUME_NONNULL_BEGIN /// The OID that the submodule is pinned to in the parent repository's index. /// /// If the submodule is not in the index, this will be nil. -@property (nonatomic, strong, readonly, nullable) GTOID *indexOID; +@property (nonatomic, strong, readonly) GTOID * _Nullable indexOID; /// The OID that the submodule is pinned to in the parent repository's HEAD /// commit. /// /// If the submodule is not in HEAD, this will be nil. -@property (nonatomic, strong, readonly, nullable) GTOID *HEADOID; +@property (nonatomic, strong, readonly) GTOID * _Nullable HEADOID; /// The OID that is checked out in the submodule repository. /// /// If the submodule is not checked out, this will be nil. -@property (nonatomic, strong, readonly, nullable) GTOID *workingDirectoryOID; +@property (nonatomic, strong, readonly) GTOID * _Nullable workingDirectoryOID; /// The name of this submodule. -@property (nonatomic, copy, readonly, nullable) NSString *name; +@property (nonatomic, copy, readonly) NSString * _Nullable name; /// The path to this submodule, relative to its parent repository's root. -@property (nonatomic, copy, readonly, nullable) NSString *path; +@property (nonatomic, copy, readonly) NSString * _Nullable path; /// The remote URL provided for this submodule, read from the parent repository's /// `.git/config` or `.gitmodules` file. -@property (nonatomic, copy, readonly, nullable) NSString *URLString; +@property (nonatomic, copy, readonly) NSString * _Nullable URLString; - (instancetype)init NS_UNAVAILABLE; @@ -99,7 +99,7 @@ NS_ASSUME_NONNULL_BEGIN /// nil. /// /// Returns an initialized GTSubmodule, or nil if an error occurs. -- (nullable instancetype)initWithGitSubmodule:(git_submodule *)submodule parentRepository:(GTRepository *)repository NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithGitSubmodule:(git_submodule *)submodule parentRepository:(GTRepository *)repository NS_DESIGNATED_INITIALIZER; /// The underlying `git_submodule` object. - (git_submodule *)git_submodule __attribute__((objc_returns_inner_pointer)); @@ -119,7 +119,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - The error if one occurred. /// /// Returns the updated submodule or nil if an error occurred. -- (nullable GTSubmodule *)submoduleByUpdatingIgnoreRule:(GTSubmoduleIgnoreRule)ignoreRule error:(NSError **)error; +- (GTSubmodule * _Nullable)submoduleByUpdatingIgnoreRule:(GTSubmoduleIgnoreRule)ignoreRule error:(NSError **)error; /// Synchronizes the submodule repository's configuration files with the settings /// from the parent repository. @@ -132,7 +132,7 @@ NS_ASSUME_NONNULL_BEGIN /// If the submodule is not currently checked out, this will fail. /// /// Returns the opened repository, or nil if an error occurs. -- (nullable GTRepository *)submoduleRepository:(NSError **)error; +- (GTRepository * _Nullable)submoduleRepository:(NSError **)error; /// Calls `-statusWithIgnoreRule:error:` with the submodule's ignore rule. - (GTSubmoduleStatus)status:(NSError **)error; diff --git a/ObjectiveGit/GTSubmodule.m b/ObjectiveGit/GTSubmodule.m index 93abf040e..8d70ea3e1 100644 --- a/ObjectiveGit/GTSubmodule.m +++ b/ObjectiveGit/GTSubmodule.m @@ -144,7 +144,7 @@ - (BOOL)sync:(NSError **)error { return YES; } -- (nullable GTRepository *)submoduleRepository:(NSError **)error { +- (GTRepository *)submoduleRepository:(NSError **)error { git_repository *repo; int gitError = git_submodule_open(&repo, self.git_submodule); if (gitError != GIT_OK) { diff --git a/ObjectiveGit/GTTag.h b/ObjectiveGit/GTTag.h index 3e452e83a..2b72bb526 100644 --- a/ObjectiveGit/GTTag.h +++ b/ObjectiveGit/GTTag.h @@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN @interface GTTag : GTObject {} /// The author of the tag. -@property (nonatomic, readonly, strong, nullable) GTSignature *tagger; +@property (nonatomic, readonly, strong) GTSignature * _Nullable tagger; /// The description given when the tag was created. @property (nonatomic, readonly, strong) NSString *message; @@ -46,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly, strong) NSString *name; /// The 'tagged' object. -@property (nonatomic, readonly, strong, nullable) GTObject *target; +@property (nonatomic, readonly, strong) GTObject * _Nullable target; /// The type of the 'tagged' object. @property (nonatomic, readonly) GTObjectType targetType; @@ -57,7 +57,7 @@ NS_ASSUME_NONNULL_BEGIN /// May be NULL. /// /// Returns the found object or nil on error. -- (nullable id)objectByPeelingTagError:(NSError **)error; +- (id _Nullable)objectByPeelingTagError:(NSError **)error; /// The underlying `git_object` as a `git_tag` object. - (git_tag *)git_tag __attribute__((objc_returns_inner_pointer)); diff --git a/ObjectiveGit/GTTree.h b/ObjectiveGit/GTTree.h index 3635e561a..80ceb507f 100644 --- a/ObjectiveGit/GTTree.h +++ b/ObjectiveGit/GTTree.h @@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly) NSUInteger entryCount; /// The contents of the tree, as an array of whose objects are of type `GTTreeEntry` -@property (nonatomic, strong, readonly, nullable) NSArray *entries; +@property (nonatomic, strong, readonly) NSArray * _Nullable entries; /// The underlying `git_object` as a `git_tree` object. - (git_tree *)git_tree __attribute__((objc_returns_inner_pointer)); @@ -57,21 +57,21 @@ NS_ASSUME_NONNULL_BEGIN /// index - index to retreive entry from /// /// returns a GTTreeEntry or nil if there is nothing at the index -- (nullable GTTreeEntry *)entryAtIndex:(NSUInteger)index; +- (GTTreeEntry * _Nullable)entryAtIndex:(NSUInteger)index; /// Get an entry by name /// /// name - the name of the entry /// /// returns a GTTreeEntry or nil if there is nothing with the specified name -- (nullable GTTreeEntry *)entryWithName:(NSString *)name; +- (GTTreeEntry * _Nullable)entryWithName:(NSString *)name; /// Get an entry by path /// /// path - the path of the entry relative to the repository root /// /// returns a GTTreeEntry or nil if there is nothing with the specified path -- (nullable GTTreeEntry *)entryWithPath:(NSString *)path error:(NSError **)error; +- (GTTreeEntry * _Nullable)entryWithPath:(NSString *)path error:(NSError **)error; /// Enumerates the contents of the tree /// @@ -98,7 +98,7 @@ NS_ASSUME_NONNULL_BEGIN /// /// Returns an index which represents the result of the merge, or nil if an error /// occurred. -- (nullable GTIndex *)merge:(GTTree *)otherTree ancestor:(nullable GTTree *)ancestorTree error:(NSError **)error; +- (GTIndex * _Nullable)merge:(GTTree *)otherTree ancestor:(GTTree * _Nullable)ancestorTree error:(NSError **)error; @end diff --git a/ObjectiveGit/GTTreeBuilder.h b/ObjectiveGit/GTTreeBuilder.h index 9daefb9d6..cfa5f8842 100644 --- a/ObjectiveGit/GTTreeBuilder.h +++ b/ObjectiveGit/GTTreeBuilder.h @@ -63,7 +63,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - The error if one occurred. /// /// Returns the initialized object, or nil if an error occurred. -- (nullable instancetype)initWithTree:(nullable GTTree *)treeOrNil repository:(GTRepository *)repository error:(NSError **)error NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithTree:(GTTree * _Nullable)treeOrNil repository:(GTRepository *)repository error:(NSError **)error NS_DESIGNATED_INITIALIZER; /// The underlying `git_treebuilder` object. - (git_treebuilder *)git_treebuilder __attribute__((objc_returns_inner_pointer)); @@ -82,7 +82,7 @@ NS_ASSUME_NONNULL_BEGIN /// fileName - File name for the object in the index. Cannot be nil. /// /// Returns the matching entry or nil if it doesn't exist. -- (nullable GTTreeEntry *)entryWithFileName:(NSString *)fileName; +- (GTTreeEntry * _Nullable)entryWithFileName:(NSString *)fileName; /// Adds or updates the entry for the file name with the given data. When the /// tree is written, a blob will be inserted into the object database containing @@ -94,7 +94,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - The error if one occurred. /// /// Returns the added entry, or nil if an error occurred -- (nullable GTTreeEntry *)addEntryWithData:(NSData *)data fileName:(NSString *)fileName fileMode:(GTFileMode)fileMode error:(NSError **)error; +- (GTTreeEntry * _Nullable)addEntryWithData:(NSData *)data fileName:(NSString *)fileName fileMode:(GTFileMode)fileMode error:(NSError **)error; /// Add or update an entry to the builder. /// @@ -111,7 +111,7 @@ NS_ASSUME_NONNULL_BEGIN /// the type of the pointed at object. /// /// Returns the added entry, or nil if an error occurred. -- (nullable GTTreeEntry *)addEntryWithOID:(GTOID *)oid fileName:(NSString *)fileName fileMode:(GTFileMode)fileMode error:(NSError **)error; +- (GTTreeEntry * _Nullable)addEntryWithOID:(GTOID *)oid fileName:(NSString *)fileName fileMode:(GTFileMode)fileMode error:(NSError **)error; /// Remove an entry from the builder by its file name. /// @@ -126,7 +126,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - The error if one occurred. /// /// Returns the written tree, or nil if an error occurred. -- (nullable GTTree *)writeTree:(NSError **)error; +- (GTTree * _Nullable)writeTree:(NSError **)error; @end diff --git a/ObjectiveGit/GTTreeEntry.h b/ObjectiveGit/GTTreeEntry.h index 70e51e6a7..f90bc135a 100644 --- a/ObjectiveGit/GTTreeEntry.h +++ b/ObjectiveGit/GTTreeEntry.h @@ -36,16 +36,16 @@ NS_ASSUME_NONNULL_BEGIN @interface GTTreeEntry : NSObject /// Initializes the receiver. -- (nullable instancetype)initWithEntry:(const git_tree_entry *)theEntry parentTree:(nullable GTTree *)parent error:(NSError **)error; +- (instancetype _Nullable)initWithEntry:(const git_tree_entry *)theEntry parentTree:(GTTree * _Nullable)parent error:(NSError **)error; /// Convience class initializer. -+ (nullable instancetype)entryWithEntry:(const git_tree_entry *)theEntry parentTree:(nullable GTTree *)parent error:(NSError **)error; ++ (instancetype _Nullable)entryWithEntry:(const git_tree_entry *)theEntry parentTree:(GTTree * _Nullable)parent error:(NSError **)error; /// The underlying `git_tree_entry`. - (git_tree_entry *)git_tree_entry __attribute__((objc_returns_inner_pointer)); /// The entry's parent tree. This may be nil if nil parentTree is passed in to -initWithEntry: -@property (nonatomic, strong, readonly, nullable) GTTree *tree; +@property (nonatomic, strong, readonly) GTTree * _Nullable tree; /// The filename of the entry @property (nonatomic, copy, readonly) NSString *name; @@ -54,28 +54,28 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly) NSInteger attributes; /// The SHA hash of the entry -@property (nonatomic, copy, readonly, nullable) NSString *SHA; +@property (nonatomic, copy, readonly) NSString * _Nullable SHA; /// The type of GTObject that -object: will return. @property (nonatomic, readonly) GTObjectType type; /// The OID of the entry. -@property (nonatomic, strong, readonly, nullable) GTOID *OID; +@property (nonatomic, strong, readonly) GTOID * _Nullable OID; /// Convert the entry into an GTObject /// /// error - will be filled if an error occurs /// /// Returns this entry as a GTObject or nil if an error occurred. -- (nullable GTObject *)GTObject:(NSError **)error; +- (GTObject * _Nullable)GTObject:(NSError **)error; @end @interface GTObject (GTTreeEntry) -+ (nullable instancetype)objectWithTreeEntry:(GTTreeEntry *)treeEntry error:(NSError **)error; -- (nullable instancetype)initWithTreeEntry:(GTTreeEntry *)treeEntry error:(NSError **)error; ++ (instancetype _Nullable)objectWithTreeEntry:(GTTreeEntry *)treeEntry error:(NSError **)error; +- (instancetype _Nullable)initWithTreeEntry:(GTTreeEntry *)treeEntry error:(NSError **)error; @end diff --git a/ObjectiveGitTests/GTRepositoryStashingSpec.m b/ObjectiveGitTests/GTRepositoryStashingSpec.m index 75a51a328..e3e7ffc29 100644 --- a/ObjectiveGitTests/GTRepositoryStashingSpec.m +++ b/ObjectiveGitTests/GTRepositoryStashingSpec.m @@ -158,7 +158,7 @@ BOOL success = NO; __block NSUInteger lastStashIndex = 0; - [repository enumerateStashesUsingBlock:^(NSUInteger index, NSString * __nullable message, GTOID * __nullable oid, BOOL * __nonnull stop) { + [repository enumerateStashesUsingBlock:^(NSUInteger index, NSString * _Nullable message, GTOID * _Nullable oid, BOOL * _Nonnull stop) { lastStashIndex = index; }]; From 7de377eab4ad629eaffeb5aff5eaea2d57922d1f Mon Sep 17 00:00:00 2001 From: Alexander Hedges Date: Thu, 9 Mar 2017 18:39:06 +0100 Subject: [PATCH 136/228] tiny whitespace fix --- ObjectiveGit/GTRepository.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index 1d1129a7a..aa7debebf 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -84,7 +84,7 @@ extern NSString * const GTRepositoryCloneOptionsCredentialProvider; extern NSString * const GTRepositoryCloneOptionsCloneLocal; /// A NSURL pointing to a local file that contains PEM-encoded certificate chain. -extern NSString *const GTRepositoryCloneOptionsServerCertificateURL; +extern NSString * const GTRepositoryCloneOptionsServerCertificateURL; /// Repository extended open control flags for /// +initWithURL:flags:ceilingDirs:error:. From 1279d2f33bdc2ff2e9309970463dca2733c23313 Mon Sep 17 00:00:00 2001 From: Alexander Hedges Date: Thu, 9 Mar 2017 18:52:57 +0100 Subject: [PATCH 137/228] change the ones I missed --- ObjectiveGit/GTCheckoutOptions.h | 2 +- ObjectiveGit/GTCheckoutOptions.m | 4 ++-- ObjectiveGit/GTRepository.m | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ObjectiveGit/GTCheckoutOptions.h b/ObjectiveGit/GTCheckoutOptions.h index ae3897e03..386838376 100644 --- a/ObjectiveGit/GTCheckoutOptions.h +++ b/ObjectiveGit/GTCheckoutOptions.h @@ -64,7 +64,7 @@ typedef NS_OPTIONS(NSInteger, GTCheckoutNotifyFlags) { /// @param notifyBlock A block that will be called for each event, @see `notifyFlags`. /// /// @return A newly-initialized GTCheckoutOptions object. -+ (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags progressBlock:(nullable void (^)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps))progressBlock notifyBlock:(nullable int (^)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir))notifyBlock; ++ (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags progressBlock:(void (^ _Nullable)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps))progressBlock notifyBlock:(int (^ _Nullable)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir))notifyBlock; /// Create a checkout options object. /// @see +checkoutOptionsWithStrategy:notifyFlags:progressBlock:notifyBlock: diff --git a/ObjectiveGit/GTCheckoutOptions.m b/ObjectiveGit/GTCheckoutOptions.m index f4c18ed5e..354e330c6 100644 --- a/ObjectiveGit/GTCheckoutOptions.m +++ b/ObjectiveGit/GTCheckoutOptions.m @@ -16,7 +16,7 @@ typedef void (^GTCheckoutProgressBlock)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps); // The type of block set in notifyBlock for notification reporting -typedef int (^GTCheckoutNotifyBlock)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile * __nullable baseline, GTDiffFile * __nullable target, GTDiffFile * __nullable workdir); +typedef int (^GTCheckoutNotifyBlock)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile * _Nullable baseline, GTDiffFile * _Nullable target, GTDiffFile * _Nullable workdir); @interface GTCheckoutOptions () { @@ -26,7 +26,7 @@ @interface GTCheckoutOptions () { @implementation GTCheckoutOptions -+ (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags progressBlock:(nullable GTCheckoutProgressBlock)progressBlock notifyBlock:(nullable GTCheckoutNotifyBlock)notifyBlock { ++ (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags progressBlock:(GTCheckoutProgressBlock _Nullable)progressBlock notifyBlock:( GTCheckoutNotifyBlock _Nullable)notifyBlock { GTCheckoutOptions *options = [self checkoutOptionsWithStrategy:strategy]; options.notifyFlags = notifyFlags; options.notifyBlock = notifyBlock; diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 3a916577d..5f9f2fb7b 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -242,7 +242,7 @@ static int remoteCreate(git_remote **remote, git_repository *repo, const char *n git_remote_callbacks remoteCallbacks; }; -+ (instancetype _Nullable)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(nullable NSDictionary *)options error:(NSError **)error transferProgressBlock:(void (^ _Nullable)(const git_transfer_progress *, BOOL *stop))transferProgressBlock { ++ (instancetype _Nullable)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(NSDictionary * _Nullable)options error:(NSError **)error transferProgressBlock:(void (^ _Nullable)(const git_transfer_progress *, BOOL *stop))transferProgressBlock { git_clone_options cloneOptions = GIT_CLONE_OPTIONS_INIT; @@ -815,7 +815,7 @@ - (BOOL)moveHEADToCommit:(GTCommit *)commit error:(NSError **)error { return gitError == GIT_OK; } -- (BOOL)performCheckout:(GTObject *)target options:(nullable GTCheckoutOptions *)options error:(NSError **)error { +- (BOOL)performCheckout:(GTObject *)target options:(GTCheckoutOptions * _Nullable)options error:(NSError **)error { int gitError = git_checkout_tree(self.git_repository, target.git_object, options.git_checkoutOptions); if (gitError < GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to checkout tree."]; @@ -838,7 +838,7 @@ - (BOOL)checkoutReference:(GTReference *)targetReference options:(GTCheckoutOpti return [self moveHEADToReference:targetReference error:error]; } -- (BOOL)checkoutTree:(GTTree *)targetTree options:(nullable GTCheckoutOptions *)options error:(NSError **)error { +- (BOOL)checkoutTree:(GTTree *)targetTree options:(GTCheckoutOptions * _Nullable)options error:(NSError **)error { return [self performCheckout:targetTree options:options error:error]; } From 6ba2f5d14b285808ecd5df463f5981974800bc59 Mon Sep 17 00:00:00 2001 From: David Catmull Date: Mon, 20 Mar 2017 09:29:54 -0600 Subject: [PATCH 138/228] GTObject method should be nullable --- ObjectiveGit/GTIndexEntry.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTIndexEntry.h b/ObjectiveGit/GTIndexEntry.h index 8b5ff9f23..417e789cf 100644 --- a/ObjectiveGit/GTIndexEntry.h +++ b/ObjectiveGit/GTIndexEntry.h @@ -80,7 +80,7 @@ NS_ASSUME_NONNULL_BEGIN /// error - will be filled if an error occurs /// /// Returns this entry as a GTObject or nil if an error occurred. -- (GTObject *)GTObject:(NSError **)error; +- (nullable GTObject *)GTObject:(NSError **)error; @end From 39477a1c5a1591006fa422c801c5ca739cd8cea7 Mon Sep 17 00:00:00 2001 From: Alexander Hedges Date: Sun, 28 May 2017 15:36:51 +0200 Subject: [PATCH 139/228] Wrap git_index_add_all --- ObjectiveGit/GTIndex.h | 7 +++++++ ObjectiveGit/GTIndex.m | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/ObjectiveGit/GTIndex.h b/ObjectiveGit/GTIndex.h index ba57ac2f3..d0df6e4ec 100644 --- a/ObjectiveGit/GTIndex.h +++ b/ObjectiveGit/GTIndex.h @@ -155,6 +155,13 @@ NS_ASSUME_NONNULL_BEGIN /// Returns whether reading the tree was successful. - (BOOL)addContentsOfTree:(GTTree *)tree error:(NSError **)error; +/// Add all the content of the working directory to the index. Like `git add -A` +/// +/// error - If not NULL, set to any error that occurs. +/// +/// Returns whether the operation was successful +- (BOOL)addAll:(NSError **)error; + /// Remove an entry (by relative path) from the index. /// Will fail if the receiver's repository is nil. /// diff --git a/ObjectiveGit/GTIndex.m b/ObjectiveGit/GTIndex.m index 863beb9cc..0acbf0c90 100644 --- a/ObjectiveGit/GTIndex.m +++ b/ObjectiveGit/GTIndex.m @@ -218,6 +218,16 @@ - (BOOL)addContentsOfTree:(GTTree *)tree error:(NSError **)error { return YES; } +- (BOOL)addAll:(NSError **)error { + int status = git_index_add_all(self.git_index, nil, GIT_INDEX_ADD_CHECK_PATHSPEC, nil, nil); + if (status != GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:status description:@"Failed to add all the contents of the working tree to the index"]; + return NO; + } + + return YES; +} + - (BOOL)removeFile:(NSString *)file error:(NSError **)error { NSString *unicodeString = [self composedUnicodeStringWithString:file]; From 26a85b23d2ade8cdb315330143c50ac0084bd44e Mon Sep 17 00:00:00 2001 From: Alexander Hedges Date: Sun, 28 May 2017 18:41:37 +0200 Subject: [PATCH 140/228] Wrap git_merge_file --- ObjectiveGit/GTRepository+Merging.h | 13 +++++ ObjectiveGit/GTRepository+Merging.m | 82 +++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) diff --git a/ObjectiveGit/GTRepository+Merging.h b/ObjectiveGit/GTRepository+Merging.h index 00a025073..27026642a 100644 --- a/ObjectiveGit/GTRepository+Merging.h +++ b/ObjectiveGit/GTRepository+Merging.h @@ -7,6 +7,7 @@ // #import "GTRepository.h" +#import "GTIndexEntry.h" #import "git2/merge.h" NS_ASSUME_NONNULL_BEGIN @@ -52,6 +53,18 @@ typedef NS_OPTIONS(NSInteger, GTMergeAnalysis) { /// will point to an error describing what happened). - (BOOL)mergeBranchIntoCurrentBranch:(GTBranch *)fromBranch withError:(NSError **)error; +/// Gets the file content with conflict markers for the given file +/// +/// The parameters taked are the ones received from `enumerateConflictedFiles`. +/// +/// ancestor - The ancestor entry +/// ours - The index entry of our side +/// theirs - The index entry of their side +/// error - The error if one occurred. Can be NULL. +/// +/// Returns The file content annotated with conflict markers or null on error +- (NSString* _Nullable)stringForConflictWithAncestor:(GTIndexEntry *)ancestor ourSide:(GTIndexEntry *)ourSide theirSide:(GTIndexEntry *)theirSide withError:(NSError **)error; + /// Analyze which merge to perform. /// /// analysis - The resulting analysis. diff --git a/ObjectiveGit/GTRepository+Merging.m b/ObjectiveGit/GTRepository+Merging.m index 958f53ec6..4d6cefcf9 100644 --- a/ObjectiveGit/GTRepository+Merging.m +++ b/ObjectiveGit/GTRepository+Merging.m @@ -17,6 +17,8 @@ #import "GTTree.h" #import "GTIndex.h" #import "GTIndexEntry.h" +#import "GTOdbObject.h" +#import "GTObjectDatabase.h" typedef void (^GTRemoteFetchTransferProgressBlock)(const git_transfer_progress *stats, BOOL *stop); @@ -170,6 +172,86 @@ - (BOOL)mergeBranchIntoCurrentBranch:(GTBranch *)branch withError:(NSError **)er return NO; } +- (NSString* _Nullable)stringForConflictWithAncestor:(GTIndexEntry *)ancestor ourSide:(GTIndexEntry *)ourSide theirSide:(GTIndexEntry *)theirSide withError:(NSError **)error { + + GTObjectDatabase *database = [self objectDatabaseWithError:error]; + if (database == nil) { + return nil; + } + + // initialize the ancestor's merge file input + git_merge_file_input ancestorInput; + int gitError = git_merge_file_init_input(&ancestorInput, GIT_MERGE_FILE_INPUT_VERSION); + if (gitError != GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to create merge file input for ancestor"]; + return nil; + } + + git_oid ancestorId = ancestor.git_index_entry->id; + GTOID *ancestorOID = [[GTOID alloc] initWithGitOid:&ancestorId]; + NSData *ancestorData = [[database objectWithOID:ancestorOID error: error] data]; + if (ancestorData == nil) { + return nil; + } + NSString *ancestorString = [[NSString alloc] initWithData: ancestorData encoding:NSUTF8StringEncoding]; + ancestorInput.ptr = [ancestorString cStringUsingEncoding:NSUTF8StringEncoding]; + ancestorInput.size = ancestorString.length; + + + // initialize our merge file input + git_merge_file_input ourInput; + gitError = git_merge_file_init_input(&ourInput, GIT_MERGE_FILE_INPUT_VERSION); + if (gitError != GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to create merge file input for our side"]; + return nil; + } + + git_oid ourId = ourSide.git_index_entry->id; + GTOID *ourOID = [[GTOID alloc] initWithGitOid:&ourId]; + NSData *ourData = [[database objectWithOID:ourOID error: error] data]; + if (ourData == nil) { + return nil; + } + NSString *ourString = [[NSString alloc] initWithData: ourData encoding:NSUTF8StringEncoding]; + ourInput.ptr = [ourString cStringUsingEncoding:NSUTF8StringEncoding]; + ourInput.size = ourString.length; + + + // initialize their merge file input + git_merge_file_input theirInput; + gitError = git_merge_file_init_input(&theirInput, GIT_MERGE_FILE_INPUT_VERSION); + if (gitError != GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to create merge file input other side"]; + return nil; + } + + git_oid theirId = theirSide.git_index_entry->id; + GTOID *theirOID = [[GTOID alloc] initWithGitOid:&theirId]; + NSData *theirData = [[database objectWithOID:theirOID error: error] data]; + if (theirData == nil) { + return nil; + } + NSString *theirString = [[NSString alloc] initWithData: theirData encoding:NSUTF8StringEncoding]; + theirInput.ptr = [theirString cStringUsingEncoding:NSUTF8StringEncoding]; + theirInput.size = theirString.length; + + + git_merge_file_result result; + git_merge_file(&result, &ancestorInput, &ourInput, &theirInput, nil); + + char * cString = malloc(result.len * sizeof(char*) + 1); + strncpy(cString, result.ptr, result.len); + cString[result.len] = '\0'; + + NSString *mergedContent = [[NSString alloc] initWithCString:cString encoding:NSUTF8StringEncoding]; + + free(cString); + + git_merge_file_result_free(&result); + + return mergedContent; +} + - (BOOL)annotatedCommit:(git_annotated_commit **)annotatedCommit fromCommit:(GTCommit *)fromCommit error:(NSError **)error { int gitError = git_annotated_commit_lookup(annotatedCommit, self.git_repository, fromCommit.OID.git_oid); if (gitError != GIT_OK) { From 3843e9c918096074a63a9559f8a380cca4ef4194 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Wed, 23 Nov 2016 20:36:28 +0100 Subject: [PATCH 141/228] Make the iOSTests target 9.3 because that's what Quick wants --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 2f241ff67..9ff17a4ca 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -1739,7 +1739,7 @@ External/libgit2/include, /usr/local/include, ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; LIBRARY_SEARCH_PATHS = ( ., External, @@ -1773,7 +1773,7 @@ External/libgit2/include, /usr/local/include, ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; LIBRARY_SEARCH_PATHS = ( ., External, @@ -1897,7 +1897,7 @@ External/libgit2/include, /usr/local/include, ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; LIBRARY_SEARCH_PATHS = ( ., External, @@ -2134,7 +2134,7 @@ External/libgit2/include, /usr/local/include, ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; LIBRARY_SEARCH_PATHS = ( ., External, From 09802c9faa5be8b154e33c7c8f81cc7d47dc383f Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Wed, 23 Nov 2016 22:01:07 +0100 Subject: [PATCH 142/228] Output result of bootstrap deps check --- script/bootstrap | 1 + 1 file changed, 1 insertion(+) diff --git a/script/bootstrap b/script/bootstrap index 1f3ea6ebb..ffccf0212 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -71,6 +71,7 @@ check_deps () if [ "$code" -eq "0" ] then + echo "*** $tool is available" continue elif [ "$code" -ne "1" ] then From 08b137ad7be998862276a404a55266b1b79cc14e Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Mon, 29 May 2017 22:26:57 +0200 Subject: [PATCH 143/228] Use Xcode 8.3 --- .travis.yml | 6 +++--- Cartfile.private | 4 ++-- Cartfile.resolved | 8 ++++---- Carthage/Checkouts/Nimble | 2 +- Carthage/Checkouts/Quick | 2 +- Carthage/Checkouts/ZipArchive | 2 +- Carthage/Checkouts/xcconfigs | 2 +- .../project.pbxproj | 18 ++++++++++++++++-- .../xcschemes/ObjectiveGit Mac.xcscheme | 2 +- .../xcschemes/ObjectiveGit iOS.xcscheme | 2 +- ObjectiveGitTests/Libgit2FeaturesSpec.m | 2 +- 11 files changed, 32 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index c9ad0c8c6..290c63d1a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,12 @@ -osx_image: xcode8 +osx_image: xcode8.3 language: objective-c matrix: fast_finish: true include: - - osx_image: xcode8 + - osx_image: xcode8.3 env: - SCHEME="ObjectiveGit Mac" - - osx_image: xcode8 + - osx_image: xcode8.3 env: - SCHEME="ObjectiveGit iOS" before_install: diff --git a/Cartfile.private b/Cartfile.private index d7373ca9f..3a814744e 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,4 +1,4 @@ github "jspahrsummers/xcconfigs" >= 0.7.1 -github "Quick/Quick" ~> 0.9.2 -github "Quick/Nimble" ~> 4.0 +github "Quick/Quick" ~> 1.1.0 +github "Quick/Nimble" ~> 5.0 github "ZipArchive/ZipArchive" ~> 1.1 diff --git a/Cartfile.resolved b/Cartfile.resolved index f2376fca0..5ae1e6e22 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ -github "Quick/Nimble" "v4.1.0" -github "Quick/Quick" "v0.9.3" -github "ZipArchive/ZipArchive" "v1.6.2" -github "jspahrsummers/xcconfigs" "0.9" +github "Quick/Nimble" "v5.1.1" +github "Quick/Quick" "v1.1.0" +github "ZipArchive/ZipArchive" "v1.8.1" +github "jspahrsummers/xcconfigs" "0.10" diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble index b4a0f9d6e..3720e6b0f 160000 --- a/Carthage/Checkouts/Nimble +++ b/Carthage/Checkouts/Nimble @@ -1 +1 @@ -Subproject commit b4a0f9d6ee6b89f0e2f9ee8fa32aaa7200b1e27c +Subproject commit 3720e6b0f6de6d6435f79f8a174fb4bb92df5dc4 diff --git a/Carthage/Checkouts/Quick b/Carthage/Checkouts/Quick index faa6056c0..e4fa1e85c 160000 --- a/Carthage/Checkouts/Quick +++ b/Carthage/Checkouts/Quick @@ -1 +1 @@ -Subproject commit faa6056c0c7da69fc1fb494cf61fa264aea4d9bc +Subproject commit e4fa1e85c0305ba4e0866f25812d3fa398f3a048 diff --git a/Carthage/Checkouts/ZipArchive b/Carthage/Checkouts/ZipArchive index 76ca4b329..92f3cac49 160000 --- a/Carthage/Checkouts/ZipArchive +++ b/Carthage/Checkouts/ZipArchive @@ -1 +1 @@ -Subproject commit 76ca4b3293e2effa548fdd6b09f8925a85d35a92 +Subproject commit 92f3cac49f7b70fc1466d681ac0e13ff91cf7898 diff --git a/Carthage/Checkouts/xcconfigs b/Carthage/Checkouts/xcconfigs index d78854b22..cc451b08e 160000 --- a/Carthage/Checkouts/xcconfigs +++ b/Carthage/Checkouts/xcconfigs @@ -1 +1 @@ -Subproject commit d78854b22b9567e7f30d748bdd4966c86bcc93a5 +Subproject commit cc451b08e052b6146f5caf66bc1120420c529c7b diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 9ff17a4ca..81414dc2a 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -1279,11 +1279,11 @@ attributes = { LastSwiftUpdateCheck = 0700; LastTestingUpgradeCheck = 0510; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0830; ORGANIZATIONNAME = "GitHub, Inc"; TargetAttributes = { 88F05A6A16011E5400B7AD1D = { - LastSwiftMigration = 0800; + LastSwiftMigration = 0830; }; 8DC2EF4F0486A6940098B216 = { LastSwiftMigration = 0800; @@ -1294,6 +1294,7 @@ }; F879D8351B4B7F7C002D5C07 = { CreatedOnToolsVersion = 6.4; + LastSwiftMigration = 0830; }; }; }; @@ -1861,6 +1862,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -1880,6 +1882,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Release; }; @@ -1957,6 +1960,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Test; }; @@ -2194,6 +2198,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Profile; }; @@ -2276,6 +2281,7 @@ "NS_ENFORCE_NSOBJECT_DESIGNATED_INITIALIZER=0", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO; @@ -2295,6 +2301,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -2321,6 +2328,7 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO; @@ -2340,6 +2348,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + SWIFT_VERSION = 3.0; VALIDATE_PRODUCT = YES; }; name = Test; @@ -2367,6 +2376,7 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO; @@ -2386,6 +2396,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 3.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -2413,6 +2425,7 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO; @@ -2432,6 +2445,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + SWIFT_VERSION = 3.0; VALIDATE_PRODUCT = YES; }; name = Profile; diff --git a/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme b/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme index 245964018..be4d229d6 100644 --- a/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme +++ b/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme @@ -1,6 +1,6 @@ Date: Sun, 4 Jun 2017 16:24:22 +0200 Subject: [PATCH 144/228] Add test for addAll --- ObjectiveGitTests/GTIndexSpec.m | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ObjectiveGitTests/GTIndexSpec.m b/ObjectiveGitTests/GTIndexSpec.m index 48b258e8a..1dddd2170 100644 --- a/ObjectiveGitTests/GTIndexSpec.m +++ b/ObjectiveGitTests/GTIndexSpec.m @@ -227,6 +227,33 @@ renamedFileURL = [NSURL fileURLWithPath:newPath isDirectory:NO]; }); + it(@"should add all files from the current file system to the index", ^{ + NSData *currentFileContent = [[NSFileManager defaultManager] contentsAtPath:fileURL.path]; + expect(currentFileContent).notTo(beNil()); + NSString *currentFileString = [[NSString alloc] initWithData:currentFileContent encoding:NSUTF8StringEncoding]; + currentFileString = [currentFileString stringByAppendingString:@"I would like to append this to the file"]; + currentFileContent = [currentFileString dataUsingEncoding:NSUTF8StringEncoding]; + expect(@([[NSFileManager defaultManager] createFileAtPath:fileURL.path contents:currentFileContent attributes:nil])).to(beTruthy()); + + NSString *newFileContent = @"This is a new file \n1 2 3"; + NSData *newFileData = [newFileContent dataUsingEncoding:NSUTF8StringEncoding]; + expect(newFileData).notTo(beNil()); + expect(@([[NSFileManager defaultManager] createFileAtPath:renamedFileURL.path contents:newFileData attributes:nil])).to(beTruthy()); + + GTIndexEntry *entry = [index entryWithPath:[filename decomposedStringWithCanonicalMapping]]; + expect(@(fileStatusEqualsExpected(entry.path, GTDeltaTypeUnmodified, GTDeltaTypeModified))).to(beTruthy()); + entry = [index entryWithPath:[renamedFilename decomposedStringWithCanonicalMapping]]; + expect(@(fileStatusEqualsExpected(entry.path, GTDeltaTypeUnmodified, GTDeltaTypeUntracked))).to(beTruthy()); + + expect(@([index addAll:NULL])).to(beTruthy()); + expect(@([index write:NULL])).to(beTruthy()); + + entry = [index entryWithPath:[filename decomposedStringWithCanonicalMapping]]; + expect(@(fileStatusEqualsExpected(entry.path, GTDeltaTypeModified, GTDeltaTypeUnmodified))).to(beTruthy()); + entry = [index entryWithPath:[renamedFilename decomposedStringWithCanonicalMapping]]; + expect(@(fileStatusEqualsExpected(entry.path, GTDeltaTypeAdded, GTDeltaTypeUnmodified))).to(beTruthy()); + }); + it(@"it preserves decomposed Unicode in index paths with precomposeunicode disabled", ^{ NSString *decomposedFilename = [filename decomposedStringWithCanonicalMapping]; GTIndexEntry *entry = [index entryWithPath:decomposedFilename error:NULL]; From 05bd5d4633a6a9897649a9d9ecb43af5ec3b04ce Mon Sep 17 00:00:00 2001 From: Alexander Hedges Date: Sun, 4 Jun 2017 23:53:01 +0200 Subject: [PATCH 145/228] Address comments and new test case --- ObjectiveGit/GTRepository+Merging.h | 2 +- ObjectiveGit/GTRepository+Merging.m | 25 ++++++++-------- ObjectiveGitTests/GTRepositorySpec.m | 44 ++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 13 deletions(-) diff --git a/ObjectiveGit/GTRepository+Merging.h b/ObjectiveGit/GTRepository+Merging.h index 27026642a..53649a095 100644 --- a/ObjectiveGit/GTRepository+Merging.h +++ b/ObjectiveGit/GTRepository+Merging.h @@ -63,7 +63,7 @@ typedef NS_OPTIONS(NSInteger, GTMergeAnalysis) { /// error - The error if one occurred. Can be NULL. /// /// Returns The file content annotated with conflict markers or null on error -- (NSString* _Nullable)stringForConflictWithAncestor:(GTIndexEntry *)ancestor ourSide:(GTIndexEntry *)ourSide theirSide:(GTIndexEntry *)theirSide withError:(NSError **)error; +- (NSString * _Nullable)contentsOfDiffWithAncestor:(GTIndexEntry *)ancestor ourSide:(GTIndexEntry *)ourSide theirSide:(GTIndexEntry *)theirSide error:(NSError **)error; /// Analyze which merge to perform. /// diff --git a/ObjectiveGit/GTRepository+Merging.m b/ObjectiveGit/GTRepository+Merging.m index 4d6cefcf9..6e347f3d6 100644 --- a/ObjectiveGit/GTRepository+Merging.m +++ b/ObjectiveGit/GTRepository+Merging.m @@ -172,7 +172,7 @@ - (BOOL)mergeBranchIntoCurrentBranch:(GTBranch *)branch withError:(NSError **)er return NO; } -- (NSString* _Nullable)stringForConflictWithAncestor:(GTIndexEntry *)ancestor ourSide:(GTIndexEntry *)ourSide theirSide:(GTIndexEntry *)theirSide withError:(NSError **)error { +- (NSString * _Nullable)contentsOfDiffWithAncestor:(GTIndexEntry *)ancestor ourSide:(GTIndexEntry *)ourSide theirSide:(GTIndexEntry *)theirSide error:(NSError **)error { GTObjectDatabase *database = [self objectDatabaseWithError:error]; if (database == nil) { @@ -193,9 +193,8 @@ - (NSString* _Nullable)stringForConflictWithAncestor:(GTIndexEntry *)ancestor ou if (ancestorData == nil) { return nil; } - NSString *ancestorString = [[NSString alloc] initWithData: ancestorData encoding:NSUTF8StringEncoding]; - ancestorInput.ptr = [ancestorString cStringUsingEncoding:NSUTF8StringEncoding]; - ancestorInput.size = ancestorString.length; + ancestorInput.ptr = ancestorData.bytes; + ancestorInput.size = ancestorData.length; // initialize our merge file input @@ -212,9 +211,8 @@ - (NSString* _Nullable)stringForConflictWithAncestor:(GTIndexEntry *)ancestor ou if (ourData == nil) { return nil; } - NSString *ourString = [[NSString alloc] initWithData: ourData encoding:NSUTF8StringEncoding]; - ourInput.ptr = [ourString cStringUsingEncoding:NSUTF8StringEncoding]; - ourInput.size = ourString.length; + ourInput.ptr = ourData.bytes; + ourInput.size = ourData.length; // initialize their merge file input @@ -231,15 +229,18 @@ - (NSString* _Nullable)stringForConflictWithAncestor:(GTIndexEntry *)ancestor ou if (theirData == nil) { return nil; } - NSString *theirString = [[NSString alloc] initWithData: theirData encoding:NSUTF8StringEncoding]; - theirInput.ptr = [theirString cStringUsingEncoding:NSUTF8StringEncoding]; - theirInput.size = theirString.length; + theirInput.ptr = theirData.bytes; + theirInput.size = theirData.length; git_merge_file_result result; - git_merge_file(&result, &ancestorInput, &ourInput, &theirInput, nil); + gitError = git_merge_file(&result, &ancestorInput, &ourInput, &theirInput, nil); + if (gitError != GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to create merge file"]; + return nil; + } - char * cString = malloc(result.len * sizeof(char*) + 1); + char *cString = malloc(result.len * sizeof(char *) + 1); strncpy(cString, result.ptr, result.len); cString[result.len] = '\0'; diff --git a/ObjectiveGitTests/GTRepositorySpec.m b/ObjectiveGitTests/GTRepositorySpec.m index efe61d1bf..19914c392 100644 --- a/ObjectiveGitTests/GTRepositorySpec.m +++ b/ObjectiveGitTests/GTRepositorySpec.m @@ -260,6 +260,50 @@ }); }); +describe(@"-contentsOfDiffWithAncestor:ourSide:theirSide:error:", ^{ + it(@"should produce a nice merge conflict description", ^{ + NSURL *mainURL = [repository.fileURL URLByAppendingPathComponent:@"main.m"]; + NSData *mainData = [[NSFileManager defaultManager] contentsAtPath:mainURL.path]; + expect(mainData).notTo(beNil()); + + NSString *mainString = [[NSString alloc] initWithData:mainData encoding:NSUTF8StringEncoding]; + NSData *masterData = [[mainString stringByReplacingOccurrencesOfString:@"return" withString:@"//The meaning of life is 41\n return"] dataUsingEncoding:NSUTF8StringEncoding]; + NSData *otherData = [[mainString stringByReplacingOccurrencesOfString:@"return" withString:@"//The meaning of life is 42\n return"] dataUsingEncoding:NSUTF8StringEncoding]; + + expect(@([[NSFileManager defaultManager] createFileAtPath:mainURL.path contents:masterData attributes:nil])).to(beTruthy()); + + GTIndex *index = [repository indexWithError:NULL]; + expect(@([index addFile:mainURL.lastPathComponent error:NULL])).to(beTruthy()); + GTReference *head = [repository headReferenceWithError:NULL]; + GTCommit *parent = [repository lookUpObjectByOID:head.targetOID objectType:GTObjectTypeCommit error:NULL]; + expect(parent).toNot(beNil()); + GTCommit *masterCommit = [repository createCommitWithTree:[index writeTree:NULL] message:@"MOLTAE is 41" parents:[NSArray arrayWithObject:parent] updatingReferenceNamed:head.name error:NULL]; + expect(masterCommit).toNot(beNil()); + + GTBranch *otherBranch = [repository lookUpBranchWithName:@"other-branch" type:GTBranchTypeLocal success:NULL error:NULL]; + expect(otherBranch).toNot(beNil()); + expect(@([repository checkoutReference:otherBranch.reference options:nil error:NULL])).to(beTruthy()); + + expect(@([[NSFileManager defaultManager] createFileAtPath:mainURL.path contents:otherData attributes:nil])).to(beTruthy()); + + index = [repository indexWithError:NULL]; + expect(@([index addFile:mainURL.lastPathComponent error:NULL])).to(beTruthy()); + parent = [repository lookUpObjectByOID:otherBranch.OID objectType:GTObjectTypeCommit error:NULL]; + expect(parent).toNot(beNil()); + GTCommit *otherCommit = [repository createCommitWithTree:[index writeTree:NULL] message:@"MOLTAE is 42!" parents:[NSArray arrayWithObject:parent] updatingReferenceNamed:otherBranch.name error:NULL]; + expect(otherCommit).toNot(beNil()); + + GTIndex *conflictIndex = [otherCommit merge:masterCommit error:NULL]; + expect(@([conflictIndex hasConflicts])).to(beTruthy()); + + [conflictIndex enumerateConflictedFilesWithError:NULL usingBlock:^(GTIndexEntry * _Nonnull ancestor, GTIndexEntry * _Nonnull ours, GTIndexEntry * _Nonnull theirs, BOOL * _Nonnull stop) { + + NSString *conflictString = [repository contentsOfDiffWithAncestor:ancestor ourSide:ours theirSide:theirs error:NULL]; + expect(conflictString).to(equal(@"//\n// main.m\n// Test\n//\n// Created by Joe Ricioppo on 9/28/10.\n// Copyright 2010 __MyCompanyName__. All rights reserved.\n//\n\n#import \n\nint main(int argc, char *argv[])\n{\n<<<<<<< file.txt\n //The meaning of life is 42\n=======\n //The meaning of life is 41\n>>>>>>> file.txt\n return NSApplicationMain(argc, (const char **) argv);\n}\n123456789\n123456789\n123456789\n123456789!blah!\n")); + }]; + }); +}); + describe(@"-mergeBaseBetweenFirstOID:secondOID:error:", ^{ it(@"should find the merge base between two branches", ^{ NSError *error = nil; From 831722b85e6cbbc28f03f93712eaeaff360c39cf Mon Sep 17 00:00:00 2001 From: Alexander Hedges Date: Mon, 5 Jun 2017 10:15:31 +0200 Subject: [PATCH 146/228] Use trees in test instead of commits --- ObjectiveGitTests/GTRepositorySpec.m | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ObjectiveGitTests/GTRepositorySpec.m b/ObjectiveGitTests/GTRepositorySpec.m index 19914c392..b6ebc780a 100644 --- a/ObjectiveGitTests/GTRepositorySpec.m +++ b/ObjectiveGitTests/GTRepositorySpec.m @@ -277,8 +277,8 @@ GTReference *head = [repository headReferenceWithError:NULL]; GTCommit *parent = [repository lookUpObjectByOID:head.targetOID objectType:GTObjectTypeCommit error:NULL]; expect(parent).toNot(beNil()); - GTCommit *masterCommit = [repository createCommitWithTree:[index writeTree:NULL] message:@"MOLTAE is 41" parents:[NSArray arrayWithObject:parent] updatingReferenceNamed:head.name error:NULL]; - expect(masterCommit).toNot(beNil()); + GTTree *masterTree = [index writeTree:NULL]; + expect(masterTree).toNot(beNil()); GTBranch *otherBranch = [repository lookUpBranchWithName:@"other-branch" type:GTBranchTypeLocal success:NULL error:NULL]; expect(otherBranch).toNot(beNil()); @@ -288,12 +288,10 @@ index = [repository indexWithError:NULL]; expect(@([index addFile:mainURL.lastPathComponent error:NULL])).to(beTruthy()); - parent = [repository lookUpObjectByOID:otherBranch.OID objectType:GTObjectTypeCommit error:NULL]; - expect(parent).toNot(beNil()); - GTCommit *otherCommit = [repository createCommitWithTree:[index writeTree:NULL] message:@"MOLTAE is 42!" parents:[NSArray arrayWithObject:parent] updatingReferenceNamed:otherBranch.name error:NULL]; - expect(otherCommit).toNot(beNil()); + GTTree *otherTree = [index writeTree:NULL]; + expect(otherTree).toNot(beNil()); - GTIndex *conflictIndex = [otherCommit merge:masterCommit error:NULL]; + GTIndex *conflictIndex = [otherTree merge:masterTree ancestor:parent.tree error:NULL]; expect(@([conflictIndex hasConflicts])).to(beTruthy()); [conflictIndex enumerateConflictedFilesWithError:NULL usingBlock:^(GTIndexEntry * _Nonnull ancestor, GTIndexEntry * _Nonnull ours, GTIndexEntry * _Nonnull theirs, BOOL * _Nonnull stop) { From 1e6d4a1ceaa2d8bf619f20cb7ee982e5c564fce7 Mon Sep 17 00:00:00 2001 From: Slava Karpenko Date: Wed, 13 Sep 2017 21:38:27 +0300 Subject: [PATCH 147/228] -[GTNote target] -> -[GTNote targetOID] Apparently messed this one up initially: the GTNote class itself defines a read-only accessor to `targetOID`, while public header defines a `target` property. Fixing the public header so it gets proper access to `targetOID`. --- ObjectiveGit/GTNote.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTNote.h b/ObjectiveGit/GTNote.h index 01955057f..008b78a5a 100644 --- a/ObjectiveGit/GTNote.h +++ b/ObjectiveGit/GTNote.h @@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN /// Content of the note. @property (nonatomic, readonly, strong) NSString *note; -@property (nonatomic, readonly, strong) GTObject *target; +@property (nonatomic, readonly, strong) GTOID *targetOID; /// The underlying `git_note` object. - (git_note *)git_note __attribute__((objc_returns_inner_pointer)); From e10e7128e9d5477934b646dd1637dbe6b6940445 Mon Sep 17 00:00:00 2001 From: Alexander Hedges Date: Sun, 17 Sep 2017 16:34:56 +0200 Subject: [PATCH 148/228] some changes xcode 9 suggested --- External/libextobjc/extobjc/EXTScope.h | 2 +- ObjectiveGit/GTRepository+RemoteOperations.m | 4 ++-- ObjectiveGit/GTRepository.m | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/External/libextobjc/extobjc/EXTScope.h b/External/libextobjc/extobjc/EXTScope.h index c835438cd..5c68469f6 100644 --- a/External/libextobjc/extobjc/EXTScope.h +++ b/External/libextobjc/extobjc/EXTScope.h @@ -88,7 +88,7 @@ _Pragma("clang diagnostic pop") /*** implementation details follow ***/ -typedef void (^gt_ext_cleanupBlock_t)(); +typedef void (^gt_ext_cleanupBlock_t)(void); void gt_ext_executeCleanupBlock (__strong gt_ext_cleanupBlock_t *block); diff --git a/ObjectiveGit/GTRepository+RemoteOperations.m b/ObjectiveGit/GTRepository+RemoteOperations.m index 1d3024ce2..57c92096a 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.m +++ b/ObjectiveGit/GTRepository+RemoteOperations.m @@ -266,9 +266,9 @@ - (BOOL)pushRefspecs:(NSArray *)refspecs toRemote:(GTRemote *)remote withOptions }; git_remote_callbacks remote_callbacks = GIT_REMOTE_CALLBACKS_INIT; - remote_callbacks.credentials = (credProvider != nil ? GTCredentialAcquireCallback : NULL), + remote_callbacks.credentials = (credProvider != nil ? GTCredentialAcquireCallback : NULL); remote_callbacks.push_transfer_progress = GTRemotePushTransferProgressCallback; - remote_callbacks.payload = &connectionInfo, + remote_callbacks.payload = &connectionInfo; gitError = git_remote_connect(remote.git_remote, GIT_DIRECTION_PUSH, &remote_callbacks, NULL, NULL); if (gitError != GIT_OK) { diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 239805d2b..5e4a70b9b 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -624,7 +624,7 @@ - (BOOL)isHEADUnborn { return (BOOL)git_repository_head_unborn(self.git_repository); } -- (NSString *)preparedMessageWithError:(NSError **)error { +- (NSString *)preparedMessageWithError:(NSError * __autoreleasing *)error { void (^setErrorFromCode)(int) = ^(int errorCode) { if (errorCode == 0 || errorCode == GIT_ENOTFOUND) { // Not an error. From 455973eb2c527b250df12a90cce41e1a4a6966ac Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Tue, 29 Oct 2013 22:55:12 +0100 Subject: [PATCH 149/228] Add `isTag`/`isBranch`/`isNote` to `GTReference` --- ObjectiveGit/GTReference.h | 9 +++++++++ ObjectiveGit/GTReference.m | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/ObjectiveGit/GTReference.h b/ObjectiveGit/GTReference.h index cc36b8d70..f273ca00d 100644 --- a/ObjectiveGit/GTReference.h +++ b/ObjectiveGit/GTReference.h @@ -54,9 +54,18 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly) const git_oid *git_oid; @property (nonatomic, strong, readonly) GTOID * _Nullable OID; +/// Whether this is a tag. +@property (nonatomic, readonly, getter = isTag) BOOL tag; + +/// Whether this is a local branch. +@property (nonatomic, readonly, getter = isBranch) BOOL branch; + /// Whether this is a remote-tracking branch. @property (nonatomic, readonly, getter = isRemote) BOOL remote; +/// Whether this is a note ref. +@property (nonatomic, readonly, getter = isNote) BOOL note; + /// The reflog for the reference. @property (nonatomic, readonly, strong) GTReflog *reflog; diff --git a/ObjectiveGit/GTReference.m b/ObjectiveGit/GTReference.m index 63c63836d..d34d946a2 100644 --- a/ObjectiveGit/GTReference.m +++ b/ObjectiveGit/GTReference.m @@ -105,6 +105,18 @@ - (instancetype)initWithGitReference:(git_reference *)ref repository:(GTReposito return self; } +- (BOOL)isBranch { + return git_reference_is_branch(self.git_reference) != 0; +} + +- (BOOL)isTag { + return git_reference_is_tag(self.git_reference) != 0; +} + +- (BOOL)isNote { + return git_reference_is_note(self.git_reference) != 0; +} + - (NSString *)name { const char *refName = git_reference_name(self.git_reference); if (refName == NULL) return nil; From e605d96d6f9522a796a9408bc44c7bfd429ed901 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 19 Jun 2017 21:14:23 +0200 Subject: [PATCH 150/228] Update libgit2 to 0.26 Really, sometimes after 0.26, because of a test .gitmodules which would make Travis fail. --- External/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libgit2 b/External/libgit2 index 2fcb8705e..4f4bc5732 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit 2fcb8705e584ca61f6c4657525c9d2713f6a39d2 +Subproject commit 4f4bc5732baf4545ab42bbd80d2a971e2f1e316c From a5642ffc6c4c01ed6e5eba1fbe09d8b8e9fd9d49 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Wed, 30 Oct 2013 00:55:19 +0100 Subject: [PATCH 151/228] Redo branch enumeration using `git_branch_iterator_new` --- ObjectiveGit/GTRepository.m | 53 ++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 5e4a70b9b..3c61082a5 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -395,22 +395,55 @@ - (GTReference *)headReferenceWithError:(NSError **)error { return [[GTReference alloc] initWithGitReference:headRef repository:self]; } +typedef void (^GTRepositoryBranchEnumerationBlock)(GTBranch *branch, BOOL *stop); + +- (BOOL)enumerateBranchesWithType:(GTBranchType)type error:(NSError **)error usingBlock:(GTRepositoryBranchEnumerationBlock)block { + git_branch_iterator *iter = NULL; + git_reference *gitRef = NULL; + int gitError = git_branch_iterator_new(&iter, self.git_repository, (git_branch_t)type); + if (gitError != GIT_OK) { + if (error) *error = [NSError git_errorFor:gitError description:@"Branch enumeration failed"]; + return NO; + } + + git_branch_t branchType; + while ((gitError = git_branch_next(&gitRef, &branchType, iter)) == GIT_OK) { + GTReference *ref = [[GTReference alloc] initWithGitReference:gitRef repository:self]; + GTBranch *branch = [GTBranch branchWithReference:ref repository:self]; + BOOL stop = NO; + block(branch, &stop); + if (stop) break; + } + + if (gitError != GIT_OK && gitError != GIT_ITEROVER) { + if (error) *error = [NSError git_errorFor:gitError description:@"Branch enumeration failed"]; + return NO; + } + + return YES; +} + - (NSArray *)localBranchesWithError:(NSError **)error { - return [self branchesWithPrefix:[GTBranch localNamePrefix] error:error]; + NSMutableArray *localBranches = [NSMutableArray array]; + BOOL success = [self enumerateBranchesWithType:GTBranchTypeLocal error:error usingBlock:^(GTBranch *branch, BOOL *stop) { + [localBranches addObject:branch]; + }]; + + if (success != YES) return nil; + + return [localBranches copy]; } - (NSArray *)remoteBranchesWithError:(NSError **)error { - NSArray *remoteBranches = [self branchesWithPrefix:[GTBranch remoteNamePrefix] error:error]; - if (remoteBranches == nil) return nil; + NSMutableArray *remoteBranches = [NSMutableArray array]; + BOOL success = [self enumerateBranchesWithType:GTBranchTypeRemote error:error usingBlock:^(GTBranch *branch, BOOL *stop) { + if (![branch.shortName isEqualToString:@"HEAD"]) + [remoteBranches addObject:branch]; + }]; - NSMutableArray *filteredList = [NSMutableArray arrayWithCapacity:remoteBranches.count]; - for (GTBranch *branch in remoteBranches) { - if (![branch.shortName isEqualToString:@"HEAD"]) { - [filteredList addObject:branch]; - } - } + if (success != YES) return nil; - return filteredList; + return [remoteBranches copy]; } - (NSArray *)branchesWithPrefix:(NSString *)prefix error:(NSError **)error { From 893d4209945e10786e6ed3bcd5c36c96082140a4 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 25 Mar 2016 13:05:22 +0000 Subject: [PATCH 152/228] Add push/hide HEAD/refname methods to GTEnumerator --- ObjectiveGit/GTEnumerator.h | 31 ++++++++++++++++++++++++++++ ObjectiveGit/GTEnumerator.m | 40 +++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/ObjectiveGit/GTEnumerator.h b/ObjectiveGit/GTEnumerator.h index 2ab38b841..82c3b0275 100644 --- a/ObjectiveGit/GTEnumerator.h +++ b/ObjectiveGit/GTEnumerator.h @@ -89,6 +89,21 @@ NS_ASSUME_NONNULL_BEGIN /// Returns whether pushing matching references was successful. - (BOOL)pushGlob:(NSString *)refGlob error:(NSError **)error; +/// Push HEAD reference. +/// +/// error - If not NULL, this will be set to any error that occurs. +/// +/// Returns whether pushing the HEAD reference was successful. +- (BOOL)pushHEAD:(NSError **)error; + +/// Push a reference by name. +/// +/// refName - The reference name to push. Must not be nil. +/// error - If not NULL, this will be set to any error that occurs. +/// +/// Returns whether pushing the reference name was successful. +- (BOOL)pushReferenceName:(NSString *)refName error:(NSError **)error; + /// Hides the specified commit and all of its ancestors when enumerating. /// /// sha - The SHA of a commit in the receiver's repository. This must not be @@ -106,6 +121,22 @@ NS_ASSUME_NONNULL_BEGIN /// Returns whether marking matching references for hiding was successful. - (BOOL)hideGlob:(NSString *)refGlob error:(NSError **)error; +/// Hide HEAD reference. +/// +/// error - If not NULL, this will be set to any error that occurs. +/// +/// Returns whether marking HEAD for hiding was successful. +- (BOOL)hideHEAD:(NSError **)error; + + +/// Hide a reference by name. +/// +/// refName - The reference name to hide. Must not be nil. +/// error - If not NULL, this will be set to any error that occurs. +/// +/// Returns whether hiding the reference name was successful. +- (BOOL)hideReferenceName:(NSString *)refName error:(NSError **)error; + /// Resets the receiver, putting it back into a clean state for reuse, and /// replacing the receiver's `options`. - (void)resetWithOptions:(GTEnumeratorOptions)options; diff --git a/ObjectiveGit/GTEnumerator.m b/ObjectiveGit/GTEnumerator.m index 4b45a59f8..a4685c6f2 100644 --- a/ObjectiveGit/GTEnumerator.m +++ b/ObjectiveGit/GTEnumerator.m @@ -107,6 +107,26 @@ - (BOOL)pushGlob:(NSString *)refGlob error:(NSError **)error { return YES; } +- (BOOL)pushHEAD:(NSError **)error { + int gitError = git_revwalk_push_head(self.walk); + if (gitError != GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to push HEAD onto rev walker."]; + return NO; + } + return YES; +} + +- (BOOL)pushReferenceName:(NSString *)refName error:(NSError **)error { + NSParameterAssert(refName != nil); + + int gitError = git_revwalk_push_ref(self.walk, refName.UTF8String); + if (gitError != 0) { + if (error) *error = [NSError git_errorFor:gitError description:@"Failed to push reference %@", refName]; + return NO; + } + return YES; +} + - (BOOL)hideSHA:(NSString *)sha error:(NSError **)error { NSParameterAssert(sha != nil); @@ -134,6 +154,26 @@ - (BOOL)hideGlob:(NSString *)refGlob error:(NSError **)error { return YES; } +- (BOOL)hideHEAD:(NSError **)error { + int gitError = git_revwalk_hide_head(self.walk); + if (gitError != GIT_OK) { + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to hide HEAD onto rev walker."]; + return NO; + } + return YES; +} + +- (BOOL)hideReferenceName:(NSString *)refName error:(NSError **)error { + NSParameterAssert(refName != nil); + + int gitError = git_revwalk_hide_ref(self.walk, refName.UTF8String); + if (gitError != 0) { + if (error) *error = [NSError git_errorFor:gitError description:@"Failed to hide reference %@", refName]; + return NO; + } + return YES; +} + #pragma mark Resetting - (void)resetWithOptions:(GTEnumeratorOptions)options { From c19cc870b8d81727cc51bc4acdc4ae03fe5fb339 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 25 Mar 2016 14:06:10 +0100 Subject: [PATCH 153/228] Fix error message --- ObjectiveGit/GTEnumerator.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTEnumerator.m b/ObjectiveGit/GTEnumerator.m index a4685c6f2..c61156f96 100644 --- a/ObjectiveGit/GTEnumerator.m +++ b/ObjectiveGit/GTEnumerator.m @@ -147,7 +147,7 @@ - (BOOL)hideGlob:(NSString *)refGlob error:(NSError **)error { int gitError = git_revwalk_hide_glob(self.walk, refGlob.UTF8String); if (gitError != GIT_OK) { - if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to push glob %@ onto rev walker.", refGlob]; + if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to hide glob %@ in rev walker.", refGlob]; return NO; } From 9ffb9a10ed2b33745d7aa8623eaa62f33826f662 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 11 Jul 2016 19:35:33 +0000 Subject: [PATCH 154/228] Add `-[GTTag delete:]` --- ObjectiveGit/GTTag.h | 3 +++ ObjectiveGit/GTTag.m | 9 +++++++++ ObjectiveGitTests/GTTagSpec.m | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/ObjectiveGit/GTTag.h b/ObjectiveGit/GTTag.h index 2b72bb526..bd7318e64 100644 --- a/ObjectiveGit/GTTag.h +++ b/ObjectiveGit/GTTag.h @@ -59,6 +59,9 @@ NS_ASSUME_NONNULL_BEGIN /// Returns the found object or nil on error. - (id _Nullable)objectByPeelingTagError:(NSError **)error; +/// Delete the receiver. +- (BOOL)delete:(NSError **)error; + /// The underlying `git_object` as a `git_tag` object. - (git_tag *)git_tag __attribute__((objc_returns_inner_pointer)); diff --git a/ObjectiveGit/GTTag.m b/ObjectiveGit/GTTag.m index aa3312454..3c8c617c8 100644 --- a/ObjectiveGit/GTTag.m +++ b/ObjectiveGit/GTTag.m @@ -84,4 +84,13 @@ - (id)objectByPeelingTagError:(NSError **)error { return [[GTObject alloc] initWithObj:target inRepository:self.repository]; } +- (BOOL)delete:(NSError **)error { + int gitError = git_tag_delete(self.repository.git_repository, self.name.UTF8String); + if (gitError != GIT_OK) { + if (error) *error = [NSError git_errorFor:gitError description:@"Tag deletion failed"]; + return NO; + } + return YES; +} + @end diff --git a/ObjectiveGitTests/GTTagSpec.m b/ObjectiveGitTests/GTTagSpec.m index b6ab16506..93b26e2f6 100644 --- a/ObjectiveGitTests/GTTagSpec.m +++ b/ObjectiveGitTests/GTTagSpec.m @@ -39,6 +39,18 @@ expect(signature.email).to(equal(@"schacon@gmail.com")); }); +it(@"can delete tags", ^{ + NSError *error = nil; + + BOOL success = [tag delete:&error]; + expect(@(success)).to(beTruthy()); + expect(error).to(beNil()); + + success = [tag delete:&error]; + expect(@(success)).to(beFalsy()); + expect(error).notTo(beNil()); +}); + afterEach(^{ [self tearDown]; }); From d07a74732a108f7d13df8136bd05d7697ec1874a Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Sun, 10 Nov 2013 16:20:51 +0100 Subject: [PATCH 155/228] Use the reference's repository instead of asking for one --- ObjectiveGit/GTBranch.h | 6 ++---- ObjectiveGit/GTBranch.m | 16 +++++++++------- ObjectiveGit/GTRepository.m | 12 ++++++------ ObjectiveGitTests/GTBranchSpec.m | 4 ++-- ObjectiveGitTests/GTUtilityFunctions.m | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ObjectiveGit/GTBranch.h b/ObjectiveGit/GTBranch.h index d53977643..12580632f 100644 --- a/ObjectiveGit/GTBranch.h +++ b/ObjectiveGit/GTBranch.h @@ -59,18 +59,16 @@ NS_ASSUME_NONNULL_BEGIN /// Designated initializer. /// /// ref - The branch reference to wrap. Must not be nil. -/// repo - The repository containing the branch. Must not be nil. /// /// Returns the initialized receiver. -- (instancetype _Nullable)initWithReference:(GTReference *)ref repository:(GTRepository *)repo NS_DESIGNATED_INITIALIZER; +- (instancetype _Nullable)initWithReference:(GTReference *)ref NS_DESIGNATED_INITIALIZER; /// Convenience class initializer. /// /// ref - The branch reference to wrap. Must not be nil. -/// repo - The repository containing the branch. Must not be nil. /// /// Returns an initialized instance. -+ (instancetype _Nullable)branchWithReference:(GTReference *)ref repository:(GTRepository *)repo; ++ (instancetype _Nullable)branchWithReference:(GTReference *)ref; /// Get the target commit for this branch /// diff --git a/ObjectiveGit/GTBranch.m b/ObjectiveGit/GTBranch.m index eb42f3356..f946736b1 100644 --- a/ObjectiveGit/GTBranch.m +++ b/ObjectiveGit/GTBranch.m @@ -65,8 +65,8 @@ + (NSString *)remoteNamePrefix { return @"refs/remotes/"; } -+ (instancetype)branchWithReference:(GTReference *)ref repository:(GTRepository *)repo { - return [[self alloc] initWithReference:ref repository:repo]; ++ (instancetype)branchWithReference:(GTReference *)ref { + return [[self alloc] initWithReference:ref]; } - (instancetype)init { @@ -74,14 +74,12 @@ - (instancetype)init { return nil; } -- (instancetype)initWithReference:(GTReference *)ref repository:(GTRepository *)repo { +- (instancetype)initWithReference:(GTReference *)ref { NSParameterAssert(ref != nil); - NSParameterAssert(repo != nil); self = [super init]; if (self == nil) return nil; - _repository = repo; _reference = ref; return self; @@ -142,6 +140,10 @@ - (NSUInteger)numberOfCommitsWithError:(NSError **)error { return [enumerator countRemainingObjects:error]; } +- (GTRepository *)repository { + return self.reference.repository; +} + - (GTBranchType)branchType { if (self.reference.remote) { return GTBranchTypeRemote; @@ -194,7 +196,7 @@ - (GTBranch *)trackingBranchWithError:(NSError **)error success:(BOOL *)success if (success != NULL) *success = YES; - return [[self class] branchWithReference:[[GTReference alloc] initWithGitReference:trackingRef repository:self.repository] repository:self.repository]; + return [[self class] branchWithReference:[[GTReference alloc] initWithGitReference:trackingRef repository:self.repository]]; } - (BOOL)updateTrackingBranch:(GTBranch *)trackingBranch error:(NSError **)error { @@ -216,7 +218,7 @@ - (GTBranch *)reloadedBranchWithError:(NSError **)error { GTReference *reloadedRef = [self.reference reloadedReferenceWithError:error]; if (reloadedRef == nil) return nil; - return [[self.class alloc] initWithReference:reloadedRef repository:self.repository]; + return [[self.class alloc] initWithReference:reloadedRef]; } - (BOOL)calculateAhead:(size_t *)ahead behind:(size_t *)behind relativeTo:(GTBranch *)branch error:(NSError **)error { diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 3c61082a5..e0b0a8582 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -325,7 +325,7 @@ - (id)lookUpObjectByGitOid:(const git_oid *)oid objectType:(GTObjectType)type er return nil; } - return [GTObject objectWithObj:obj inRepository:self]; + return [GTObject objectWithObj:obj inRepository:self]; } - (id)lookUpObjectByGitOid:(const git_oid *)oid error:(NSError **)error { @@ -377,7 +377,7 @@ - (GTBranch *)lookUpBranchWithName:(NSString *)branchName type:(GTBranchType)bra if (ref == NULL) return nil; GTReference *gtRef = [[GTReference alloc] initWithGitReference:ref repository:self]; - return [[GTBranch alloc] initWithReference:gtRef repository:self]; + return [[GTBranch alloc] initWithReference:gtRef]; } - (GTReference *)headReferenceWithError:(NSError **)error { @@ -409,7 +409,7 @@ - (BOOL)enumerateBranchesWithType:(GTBranchType)type error:(NSError **)error usi git_branch_t branchType; while ((gitError = git_branch_next(&gitRef, &branchType, iter)) == GIT_OK) { GTReference *ref = [[GTReference alloc] initWithGitReference:gitRef repository:self]; - GTBranch *branch = [GTBranch branchWithReference:ref repository:self]; + GTBranch *branch = [GTBranch branchWithReference:ref]; BOOL stop = NO; block(branch, &stop); if (stop) break; @@ -457,7 +457,7 @@ - (NSArray *)branchesWithPrefix:(NSString *)prefix error:(NSError **)error { GTReference *ref = [self lookUpReferenceWithName:refName error:error]; if (ref == nil) continue; - GTBranch *branch = [[GTBranch alloc] initWithReference:ref repository:self]; + GTBranch *branch = [[GTBranch alloc] initWithReference:ref]; if (branch == nil) continue; [branches addObject:branch]; @@ -594,7 +594,7 @@ - (GTBranch *)createBranchNamed:(NSString *)name fromOID:(GTOID *)targetOID mess GTReference *newRef = [self createReferenceNamed:[GTBranch.localNamePrefix stringByAppendingString:name] fromOID:targetOID message:message error:error]; if (newRef == nil) return nil; - return [GTBranch branchWithReference:newRef repository:self]; + return [GTBranch branchWithReference:newRef]; } - (BOOL)isEmpty { @@ -605,7 +605,7 @@ - (GTBranch *)currentBranchWithError:(NSError **)error { GTReference *head = [self headReferenceWithError:error]; if (head == nil) return nil; - return [GTBranch branchWithReference:head repository:self]; + return [GTBranch branchWithReference:head]; } - (NSArray *)localCommitsRelativeToRemoteBranch:(GTBranch *)remoteBranch error:(NSError **)error { diff --git a/ObjectiveGitTests/GTBranchSpec.m b/ObjectiveGitTests/GTBranchSpec.m index 09650c5f5..034ee96cb 100644 --- a/ObjectiveGitTests/GTBranchSpec.m +++ b/ObjectiveGitTests/GTBranchSpec.m @@ -163,7 +163,7 @@ expect(otherRef).notTo(beNil()); expect(error).to(beNil()); - GTBranch *otherBranch = [GTBranch branchWithReference:otherRef repository:repository]; + GTBranch *otherBranch = [GTBranch branchWithReference:otherRef]; expect(otherBranch).notTo(beNil()); BOOL success = NO; @@ -179,7 +179,7 @@ expect(remoteRef).notTo(beNil()); expect(error).to(beNil()); - GTBranch *remoteBranch = [GTBranch branchWithReference:remoteRef repository:repository]; + GTBranch *remoteBranch = [GTBranch branchWithReference:remoteRef]; expect(remoteBranch).notTo(beNil()); BOOL success = NO; diff --git a/ObjectiveGitTests/GTUtilityFunctions.m b/ObjectiveGitTests/GTUtilityFunctions.m index 95889e6de..60a84ec1d 100644 --- a/ObjectiveGitTests/GTUtilityFunctions.m +++ b/ObjectiveGitTests/GTUtilityFunctions.m @@ -16,7 +16,7 @@ CreateCommitBlock createCommitInRepository = ^ GTCommit * (NSString *message, NSData *fileData, NSString *fileName, GTRepository *repo) { GTReference *head = [repo headReferenceWithError:NULL]; - GTBranch *branch = [GTBranch branchWithReference:head repository:repo]; + GTBranch *branch = [GTBranch branchWithReference:head]; GTCommit *headCommit = [branch targetCommitWithError:NULL]; GTTreeBuilder *treeBuilder = [[GTTreeBuilder alloc] initWithTree:headCommit.tree repository:repo error:nil]; From b16d6c4296d3ca4285e7cf0d81e11c3a878c975f Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Sun, 10 Nov 2013 16:51:16 +0100 Subject: [PATCH 156/228] Use libgit2 function to get remote name. --- ObjectiveGit/GTBranch.m | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/ObjectiveGit/GTBranch.m b/ObjectiveGit/GTBranch.m index f946736b1..b40c9c6f3 100644 --- a/ObjectiveGit/GTBranch.m +++ b/ObjectiveGit/GTBranch.m @@ -32,6 +32,7 @@ #import "GTRemote.h" #import "GTRepository.h" #import "NSError+Git.h" +#import "NSData+Git.h" #import "git2/branch.h" #import "git2/errors.h" @@ -110,17 +111,12 @@ - (GTOID *)OID { } - (NSString *)remoteName { - if (self.branchType == GTBranchTypeLocal) return nil; - - const char *name; - int gitError = git_branch_name(&name, self.reference.git_reference); + git_buf remote_name = GIT_BUF_INIT_CONST(0, NULL); + int gitError = git_branch_remote_name(&remote_name, self.repository.git_repository, self.reference.name.UTF8String); if (gitError != GIT_OK) return nil; - // Find out where the remote name ends. - const char *end = strchr(name, '/'); - if (end == NULL || end == name) return nil; - - return [[NSString alloc] initWithBytes:name length:end - name encoding:NSUTF8StringEncoding]; + NSData *data = [NSData git_dataWithBuffer:&remote_name]; + return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; } - (GTCommit *)targetCommitWithError:(NSError **)error { From 8a67e0826d4f57b5dc7585d14f610a8c0bb84473 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Sun, 10 Nov 2013 16:42:16 +0100 Subject: [PATCH 157/228] Use libgit2 function to get the branch name. --- ObjectiveGit/GTBranch.m | 6 +++++- ObjectiveGit/GTRepository+Merging.m | 2 +- ObjectiveGitTests/GTBranchSpec.m | 10 ++++++++++ ObjectiveGitTests/GTRepositorySpec.m | 4 ++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ObjectiveGit/GTBranch.m b/ObjectiveGit/GTBranch.m index b40c9c6f3..084585ccb 100644 --- a/ObjectiveGit/GTBranch.m +++ b/ObjectiveGit/GTBranch.m @@ -87,7 +87,11 @@ - (instancetype)initWithReference:(GTReference *)ref { } - (NSString *)name { - return self.reference.name; + const char *charName; + int gitError = git_branch_name(&charName, self.reference.git_reference); + if (gitError != GIT_OK || charName == NULL) return nil; + + return @(charName); } - (NSString *)shortName { diff --git a/ObjectiveGit/GTRepository+Merging.m b/ObjectiveGit/GTRepository+Merging.m index 958f53ec6..d67225bb5 100644 --- a/ObjectiveGit/GTRepository+Merging.m +++ b/ObjectiveGit/GTRepository+Merging.m @@ -158,7 +158,7 @@ - (BOOL)mergeBranchIntoCurrentBranch:(GTBranch *)branch withError:(NSError **)er NSArray *parents = @[ localCommit, remoteCommit ]; // FIXME: This is stepping on the local tree - GTCommit *mergeCommit = [self createCommitWithTree:newTree message:message parents:parents updatingReferenceNamed:localBranch.name error:error]; + GTCommit *mergeCommit = [self createCommitWithTree:newTree message:message parents:parents updatingReferenceNamed:localBranch.reference.name error:error]; if (!mergeCommit) { return NO; } diff --git a/ObjectiveGitTests/GTBranchSpec.m b/ObjectiveGitTests/GTBranchSpec.m index 034ee96cb..06bf72d21 100644 --- a/ObjectiveGitTests/GTBranchSpec.m +++ b/ObjectiveGitTests/GTBranchSpec.m @@ -35,6 +35,16 @@ expect(error).to(beNil()); }); +describe(@"name", ^{ + it(@"should use just the branch name for a local branch", ^{ + expect(masterBranch.name).to(equal(@"master")); + }); + + it(@"should include the remote name for a tracking branch", ^{ + expect(trackingBranch.name).to(equal(@"origin/master")); + }); +}); + describe(@"shortName", ^{ it(@"should use just the branch name for a local branch", ^{ expect(masterBranch.shortName).to(equal(@"master")); diff --git a/ObjectiveGitTests/GTRepositorySpec.m b/ObjectiveGitTests/GTRepositorySpec.m index efe61d1bf..cef89f86e 100644 --- a/ObjectiveGitTests/GTRepositorySpec.m +++ b/ObjectiveGitTests/GTRepositorySpec.m @@ -292,7 +292,7 @@ GTBranch *currentBranch = [repository currentBranchWithError:&error]; expect(currentBranch).notTo(beNil()); expect(error).to(beNil()); - expect(currentBranch.name).to(equal(@"refs/heads/master")); + expect(currentBranch.name).to(equal(@"master")); }); }); @@ -332,7 +332,7 @@ expect(error).to(beNil()); expect(@(branches.count)).to(equal(@1)); GTBranch *remoteBranch = branches[0]; - expect(remoteBranch.name).to(equal(@"refs/remotes/origin/master")); + expect(remoteBranch.name).to(equal(@"origin/master")); }); }); From 0f15dfe393bfb9773830733fef9fcc647bf91f31 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 15 Aug 2016 14:19:17 +0000 Subject: [PATCH 158/228] Add -[GTBranch isHEAD] --- ObjectiveGit/GTBranch.h | 1 + ObjectiveGit/GTBranch.m | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/ObjectiveGit/GTBranch.h b/ObjectiveGit/GTBranch.h index 12580632f..3995eac1e 100644 --- a/ObjectiveGit/GTBranch.h +++ b/ObjectiveGit/GTBranch.h @@ -50,6 +50,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly) GTBranchType branchType; @property (nonatomic, readonly, strong) GTRepository *repository; @property (nonatomic, readonly, strong) GTReference *reference; +@property (nonatomic, readonly, getter=isHEAD) BOOL HEAD; + (NSString *)localNamePrefix; + (NSString *)remoteNamePrefix; diff --git a/ObjectiveGit/GTBranch.m b/ObjectiveGit/GTBranch.m index 084585ccb..616f7b74d 100644 --- a/ObjectiveGit/GTBranch.m +++ b/ObjectiveGit/GTBranch.m @@ -152,6 +152,10 @@ - (GTBranchType)branchType { } } +- (BOOL)isHEAD { + return (git_branch_is_head(self.reference.git_reference) ? YES : NO); +} + - (NSArray *)uniqueCommitsRelativeToBranch:(GTBranch *)otherBranch error:(NSError **)error { GTEnumerator *enumerator = [self.repository enumeratorForUniqueCommitsFromOID:self.OID relativeToOID:otherBranch.OID error:error]; return [enumerator allObjectsWithError:error]; From 08cda381a5c1eba72e6dffc9caa777dbca42b49b Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 19 Jun 2017 20:57:39 +0000 Subject: [PATCH 159/228] Add -[GTBranch rename:] --- ObjectiveGit/GTBranch.h | 3 +++ ObjectiveGit/GTBranch.m | 13 ++++++++++++ ObjectiveGitTests/GTBranchSpec.m | 35 ++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/ObjectiveGit/GTBranch.h b/ObjectiveGit/GTBranch.h index 3995eac1e..3b3be239d 100644 --- a/ObjectiveGit/GTBranch.h +++ b/ObjectiveGit/GTBranch.h @@ -78,6 +78,9 @@ NS_ASSUME_NONNULL_BEGIN /// returns a GTCommit object or nil if an error occurred - (GTCommit * _Nullable)targetCommitWithError:(NSError **)error; +/// Renames the branch. Setting `force` to YES to delete another branch with the same name. +- (BOOL)rename:(NSString *)name force:(BOOL)force error:(NSError **)error; + /// Count all commits in this branch /// /// error(out) - will be filled if an error occurs diff --git a/ObjectiveGit/GTBranch.m b/ObjectiveGit/GTBranch.m index 616f7b74d..8e9e3d362 100644 --- a/ObjectiveGit/GTBranch.m +++ b/ObjectiveGit/GTBranch.m @@ -171,6 +171,19 @@ - (BOOL)deleteWithError:(NSError **)error { return YES; } +- (BOOL)rename:(NSString *)name force:(BOOL)force error:(NSError **)error { + git_reference *git_ref; + int gitError = git_branch_move(&git_ref, self.reference.git_reference, name.UTF8String, (force ? 1 : 0)); + if (gitError != GIT_OK) { + if (error) *error = [NSError git_errorFor:gitError description:@"Rename branch failed"]; + return NO; + } + + _reference = [[GTReference alloc] initWithGitReference:git_ref repository:self.repository]; + + return YES; +} + - (GTBranch *)trackingBranchWithError:(NSError **)error success:(BOOL *)success { if (self.branchType == GTBranchTypeRemote) { if (success != NULL) *success = YES; diff --git a/ObjectiveGitTests/GTBranchSpec.m b/ObjectiveGitTests/GTBranchSpec.m index 06bf72d21..92b6cbeaf 100644 --- a/ObjectiveGitTests/GTBranchSpec.m +++ b/ObjectiveGitTests/GTBranchSpec.m @@ -272,6 +272,41 @@ }); }); +describe(@"-rename:force:error", ^{ + __block GTBranch *masterBranch; + beforeEach(^{ + masterBranch = [repository lookUpBranchWithName:@"master" type:GTBranchTypeLocal success:NULL error:NULL]; + expect(masterBranch).notTo(beNil()); + }); + + it(@"should rename the branch", ^{ + NSError *error = nil; + BOOL success = [masterBranch rename:@"plop" force:NO error:&error]; + expect(@(success)).to(beTruthy()); + expect(error).to(beNil()); + + expect(masterBranch.shortName).to(equal(@"plop")); + }); + + it(@"should fail on duplicates", ^{ + NSError *error = nil; + BOOL success = [masterBranch rename:@"feature" force:NO error:&error]; + expect(@(success)).to(beFalsy()); + expect(error).notTo(beNil()); + + expect(masterBranch.shortName).to(equal(@"master")); + }); + + it(@"should rename when forced", ^{ + NSError *error = nil; + BOOL success = [masterBranch rename:@"feature" force:YES error:&error]; + expect(@(success)).to(beTruthy()); + expect(error).to(beNil()); + + expect(masterBranch.shortName).to(equal(@"feature")); + }); +}); + // TODO: Test branch renaming, branch upstream //- (void)testCanRenameBranch { // From 3b00247d65e7a50b0472db763265b116f978393d Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 19 Jun 2017 22:12:35 +0200 Subject: [PATCH 160/228] Add `-OID` and `-parentOIDs` to GTCommit --- ObjectiveGit/GTCommit.h | 2 ++ ObjectiveGit/GTCommit.m | 17 +++++++++++++++++ ObjectiveGitTests/GTCommitSpec.m | 10 +++++++++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/ObjectiveGit/GTCommit.h b/ObjectiveGit/GTCommit.h index af84a0e4f..c9a666b76 100644 --- a/ObjectiveGit/GTCommit.h +++ b/ObjectiveGit/GTCommit.h @@ -39,9 +39,11 @@ NS_ASSUME_NONNULL_BEGIN @interface GTCommit : GTObject {} +@property (nonatomic, readonly, strong) GTOID *OID; @property (nonatomic, readonly, strong) GTSignature * _Nullable author; @property (nonatomic, readonly, strong) GTSignature * _Nullable committer; @property (nonatomic, readonly, copy) NSArray *parents; +@property (nonatomic, readonly, copy) NSArray *parentOIDs; @property (nonatomic, readonly) NSString * _Nullable message; @property (nonatomic, readonly) NSString *messageDetails; @property (nonatomic, readonly) NSString *messageSummary; diff --git a/ObjectiveGit/GTCommit.m b/ObjectiveGit/GTCommit.m index 5a6e458a6..495877a22 100644 --- a/ObjectiveGit/GTCommit.m +++ b/ObjectiveGit/GTCommit.m @@ -53,6 +53,10 @@ - (git_commit *)git_commit { #pragma mark API +- (GTOID *)OID { + return [GTOID oidWithGitOid:git_commit_id(self.git_commit)]; +} + - (NSString *)message { const char *s = git_commit_message(self.git_commit); if(s == NULL) return nil; @@ -117,6 +121,19 @@ - (BOOL)isMerge { return git_commit_parentcount(self.git_commit) > 1; } +- (NSArray *)parentOIDs { + unsigned numberOfParents = git_commit_parentcount(self.git_commit); + NSMutableArray *parents = [NSMutableArray arrayWithCapacity:numberOfParents]; + + for (unsigned i = 0; i < numberOfParents; i++) { + const git_oid *parent = git_commit_parent_id(self.git_commit, i); + + [parents addObject:[GTOID oidWithGitOid:parent]]; + } + + return parents; +} + - (NSArray *)parents { unsigned numberOfParents = git_commit_parentcount(self.git_commit); NSMutableArray *parents = [NSMutableArray arrayWithCapacity:numberOfParents]; diff --git a/ObjectiveGitTests/GTCommitSpec.m b/ObjectiveGitTests/GTCommitSpec.m index 31e80e998..af4e8fc5c 100644 --- a/ObjectiveGitTests/GTCommitSpec.m +++ b/ObjectiveGitTests/GTCommitSpec.m @@ -31,6 +31,7 @@ expect(commit).to(beAnInstanceOf(GTCommit.class)); expect(commit.type).to(equal(@"commit")); expect(commit.SHA).to(equal(commitSHA)); + expect(commit.OID).to(equal([GTOID oidWithSHA:commitSHA])); expect(commit.message).to(equal(@"testing\n")); expect(commit.messageSummary).to(equal(@"testing")); @@ -60,7 +61,14 @@ expect(commit).notTo(beNil()); expect(error).to(beNil()); - expect(@(commit.parents.count)).to(equal(@2)); + NSArray *commitOIDs = @[@"c47800c7266a2be04c571c04d5a6614691ea99bd", @"9fd738e8f7967c078dceed8190330fc8648ee56a"]; + NSArray *commitParents = commit.parentOIDs; + expect(@(commitParents.count)).to(equal(@(commitOIDs.count))); + expect([commitParents valueForKey:@"SHA"]).to(equal(commitOIDs)); + + commitParents = commit.parents; + expect(@(commitParents.count)).to(equal(@(commitOIDs.count))); + expect([commitParents valueForKeyPath:@"OID.SHA"]).to(equal(commitOIDs)); }); it(@"can identify merges", ^{ From f3d8e352acd65c1d0f9a4ad30f1739a35bec6c97 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 19 Jun 2017 22:28:08 +0200 Subject: [PATCH 161/228] Make the underlying `git_revwalk` object accessible --- ObjectiveGit/GTEnumerator.h | 3 +++ ObjectiveGit/GTEnumerator.m | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/ObjectiveGit/GTEnumerator.h b/ObjectiveGit/GTEnumerator.h index 82c3b0275..4d8b27201 100644 --- a/ObjectiveGit/GTEnumerator.h +++ b/ObjectiveGit/GTEnumerator.h @@ -64,6 +64,9 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init NS_UNAVAILABLE; +/// The underlying `git_revwalk` from libgit2. +- (git_revwalk *)git_revwalk __attribute__((objc_returns_inner_pointer)); + /// Initializes the receiver to enumerate the commits in the given repository. Designated initializer. /// /// repo - The repository to enumerate the commits of. This must not be nil. diff --git a/ObjectiveGit/GTEnumerator.m b/ObjectiveGit/GTEnumerator.m index c61156f96..6c76530c1 100644 --- a/ObjectiveGit/GTEnumerator.m +++ b/ObjectiveGit/GTEnumerator.m @@ -53,6 +53,10 @@ - (instancetype)init { return nil; } +- (git_revwalk *)git_revwalk { + return self.walk; +} + - (instancetype)initWithRepository:(GTRepository *)repo error:(NSError **)error { NSParameterAssert(repo != nil); From 0e4570bddbedddd32d349ab4d6eabc708f3d78ff Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 19 Jun 2017 22:30:40 +0200 Subject: [PATCH 162/228] Fix the pushSHA test --- ObjectiveGitTests/GTEnumeratorSpec.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ObjectiveGitTests/GTEnumeratorSpec.m b/ObjectiveGitTests/GTEnumeratorSpec.m index dda0d67b6..e9ec1649a 100644 --- a/ObjectiveGitTests/GTEnumeratorSpec.m +++ b/ObjectiveGitTests/GTEnumeratorSpec.m @@ -31,10 +31,12 @@ GTReference *HEADRef = [repo headReferenceWithError:NULL]; expect(HEADRef).notTo(beNil()); - [enumerator pushSHA:HEADRef.targetOID.SHA error:NULL]; + BOOL success = [enumerator pushSHA:HEADRef.targetOID.SHA error:&error]; + expect(@(success)).to(beTruthy()); + expect(error).to(beNil()); + NSUInteger count = [enumerator allObjects].count; expect(@(count)).to(equal(@3)); - expect(error).to(beNil()); }); describe(@"with a rev list", ^{ From b89af270bda433b60aadd86a345ee24ecbf5f23f Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 19 Jun 2017 22:46:36 +0200 Subject: [PATCH 163/228] Switch helper to the true method --- ObjectiveGitTests/GTUtilityFunctions.m | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ObjectiveGitTests/GTUtilityFunctions.m b/ObjectiveGitTests/GTUtilityFunctions.m index 60a84ec1d..f6fbe4e46 100644 --- a/ObjectiveGitTests/GTUtilityFunctions.m +++ b/ObjectiveGitTests/GTUtilityFunctions.m @@ -40,11 +40,10 @@ #pragma mark - Branch BranchBlock localBranchWithName = ^ GTBranch * (NSString *branchName, GTRepository *repo) { - NSString *reference = [GTBranch.localNamePrefix stringByAppendingString:branchName]; - NSArray *branches = [repo branchesWithPrefix:reference error:NULL]; - expect(branches).notTo(beNil()); - expect(@(branches.count)).to(equal(@1)); - expect(((GTBranch *)branches[0]).shortName).to(equal(branchName)); + BOOL success = NO; + GTBranch *branch = [repo lookUpBranchWithName:branchName type:GTBranchTypeLocal success:&success error:NULL]; + expect(branch).notTo(beNil()); + expect(branch.shortName).to(equal(branchName)); - return branches[0]; + return branch; }; From ce78f5f5ac09addf87a79a8c303effe93d47e5e3 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 19 Jun 2017 23:39:53 +0200 Subject: [PATCH 164/228] Remove commented tests we now have --- ObjectiveGitTests/GTBranchSpec.m | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/ObjectiveGitTests/GTBranchSpec.m b/ObjectiveGitTests/GTBranchSpec.m index 92b6cbeaf..f143a03e7 100644 --- a/ObjectiveGitTests/GTBranchSpec.m +++ b/ObjectiveGitTests/GTBranchSpec.m @@ -307,29 +307,6 @@ }); }); -// TODO: Test branch renaming, branch upstream -//- (void)testCanRenameBranch { -// -// NSError *error = nil; -// GTRepository *repo = [GTRepository repoByOpeningRepositoryInDirectory:[NSURL URLWithString:TEST_REPO_PATH()] error:&error]; -// STAssertNil(error, [error localizedDescription]); -// -// NSArray *branches = [GTBranch listAllLocalBranchesInRepository:repo error:&error]; -// STAssertNotNil(branches, [error localizedDescription], nil); -// STAssertEquals(2, (int)branches.count, nil); -// -// NSString *newBranchName = [NSString stringWithFormat:@"%@%@", [GTBranch localNamePrefix], @"this_is_the_renamed_branch"]; -// GTBranch *firstBranch = [branches objectAtIndex:0]; -// NSString *originalBranchName = firstBranch.name; -// BOOL success = [firstBranch.reference setName:newBranchName error:&error]; -// STAssertTrue(success, [error localizedDescription]); -// STAssertEqualObjects(firstBranch.name, newBranchName, nil); -// -// success = [firstBranch.reference setName:originalBranchName error:&error]; -// STAssertTrue(success, [error localizedDescription]); -// STAssertEqualObjects(firstBranch.name, originalBranchName, nil); -//} - afterEach(^{ [self tearDown]; }); From 3cdd4e62a4a56d68e3cac9ba6c93dc2bc4679321 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Thu, 15 Feb 2018 15:38:17 +0100 Subject: [PATCH 165/228] Update libgit2 to (almost) 0.27.0-rc1 --- External/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libgit2 b/External/libgit2 index 4f4bc5732..b8cb75361 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit 4f4bc5732baf4545ab42bbd80d2a971e2f1e316c +Subproject commit b8cb75361d48f16f41dfa99b5b988a914e53040b From 17112f5321d9f781f43bcc8d50662c4189fa0089 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Thu, 15 Feb 2018 15:38:31 +0100 Subject: [PATCH 166/228] Update libssh2 to 1.8.0 --- External/libssh2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libssh2 b/External/libssh2 index f1cfa55b6..30e9c1347 160000 --- a/External/libssh2 +++ b/External/libssh2 @@ -1 +1 @@ -Subproject commit f1cfa55b6064ba18fc0005713ed790da579361b5 +Subproject commit 30e9c1347e3b8baa2951db612f05e6d87fc8e2f2 From 74d9e7e838fc487f4e3222432a9a565fb110e5ec Mon Sep 17 00:00:00 2001 From: Stephen Bannasch Date: Sat, 7 Apr 2018 22:51:44 -0400 Subject: [PATCH 167/228] resolve string type error in GTBlob.m macosx: 10.13.4, XCode Version 9.3 (9E145) reported this error compiling line 43 in GTBlob.m: Format specifies type 'ssize_t' (aka 'long') but the argument has type 'git_off_t' (aka 'long long') and suggested this fix: Replace '%zi' with '%lli' After applying the change xcode built objective-git successfully --- ObjectiveGit/GTBlob.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTBlob.m b/ObjectiveGit/GTBlob.m index b501997a4..76ecdff54 100644 --- a/ObjectiveGit/GTBlob.m +++ b/ObjectiveGit/GTBlob.m @@ -40,7 +40,7 @@ @implementation GTBlob - (NSString *)description { - return [NSString stringWithFormat:@"<%@: %p> size: %zi, content: %@, data = %@", NSStringFromClass([self class]), self, [self size], [self content], [self data]]; + return [NSString stringWithFormat:@"<%@: %p> size: %%lli, content: %@, data = %@", NSStringFromClass([self class]), self, [self size], [self content], [self data]]; } From e5ac998103360b3f3f2d6045b2414dcab39466af Mon Sep 17 00:00:00 2001 From: Stephen Bannasch Date: Sun, 8 Apr 2018 09:03:30 -0400 Subject: [PATCH 168/228] remove extra % char pls squash with previous commit --- ObjectiveGit/GTBlob.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTBlob.m b/ObjectiveGit/GTBlob.m index 76ecdff54..1f1e5213c 100644 --- a/ObjectiveGit/GTBlob.m +++ b/ObjectiveGit/GTBlob.m @@ -40,7 +40,7 @@ @implementation GTBlob - (NSString *)description { - return [NSString stringWithFormat:@"<%@: %p> size: %%lli, content: %@, data = %@", NSStringFromClass([self class]), self, [self size], [self content], [self data]]; + return [NSString stringWithFormat:@"<%@: %p> size: %lli, content: %@, data = %@", NSStringFromClass([self class]), self, [self size], [self content], [self data]]; } From 7b32ea6c7974dd996dd7d13df6c63e83412b2f2a Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sun, 8 Apr 2018 08:39:07 -0600 Subject: [PATCH 169/228] =?UTF-8?q?=F0=9F=9B=A0=20Apply=20Xcode=209.3=20re?= =?UTF-8?q?commended=20settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Carthage/Checkouts/Nimble | 2 +- Carthage/Checkouts/Quick | 2 +- Carthage/Checkouts/ZipArchive | 2 +- Carthage/Checkouts/xcconfigs | 2 +- .../project.pbxproj | 19 ++++++++++++++++++- .../xcschemes/ObjectiveGit Mac.xcscheme | 2 +- .../xcschemes/ObjectiveGit iOS.xcscheme | 2 +- 7 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble index 3720e6b0f..22800b095 160000 --- a/Carthage/Checkouts/Nimble +++ b/Carthage/Checkouts/Nimble @@ -1 +1 @@ -Subproject commit 3720e6b0f6de6d6435f79f8a174fb4bb92df5dc4 +Subproject commit 22800b0954c89344bb8c87f8ab93378076716fb7 diff --git a/Carthage/Checkouts/Quick b/Carthage/Checkouts/Quick index e4fa1e85c..0ff81f2c6 160000 --- a/Carthage/Checkouts/Quick +++ b/Carthage/Checkouts/Quick @@ -1 +1 @@ -Subproject commit e4fa1e85c0305ba4e0866f25812d3fa398f3a048 +Subproject commit 0ff81f2c665b4381f526bd656f8708dd52a9ea2f diff --git a/Carthage/Checkouts/ZipArchive b/Carthage/Checkouts/ZipArchive index 92f3cac49..3ad651c62 160000 --- a/Carthage/Checkouts/ZipArchive +++ b/Carthage/Checkouts/ZipArchive @@ -1 +1 @@ -Subproject commit 92f3cac49f7b70fc1466d681ac0e13ff91cf7898 +Subproject commit 3ad651c62c059102acc7384dae6b0d4e0142e990 diff --git a/Carthage/Checkouts/xcconfigs b/Carthage/Checkouts/xcconfigs index cc451b08e..40f9bcc63 160000 --- a/Carthage/Checkouts/xcconfigs +++ b/Carthage/Checkouts/xcconfigs @@ -1 +1 @@ -Subproject commit cc451b08e052b6146f5caf66bc1120420c529c7b +Subproject commit 40f9bcc63752cdd95deee267d2fbf9da09a9f6f2 diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 81414dc2a..fc4b3f8ec 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -1279,7 +1279,7 @@ attributes = { LastSwiftUpdateCheck = 0700; LastTestingUpgradeCheck = 0510; - LastUpgradeCheck = 0830; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = "GitHub, Inc"; TargetAttributes = { 88F05A6A16011E5400B7AD1D = { @@ -1731,7 +1731,11 @@ buildSettings = { CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; ENABLE_TESTABILITY = YES; GCC_NO_COMMON_BLOCKS = YES; @@ -1766,7 +1770,11 @@ buildSettings = { CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO; @@ -1784,6 +1792,7 @@ "$(inherited)", "-DGIT_SSH", ); + SWIFT_COMPILATION_MODE = wholemodule; SWIFT_VERSION = 2.3; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( @@ -1892,7 +1901,11 @@ buildSettings = { CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO; @@ -2130,7 +2143,11 @@ buildSettings = { CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO; diff --git a/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme b/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme index be4d229d6..7ce4c723f 100644 --- a/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme +++ b/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme @@ -1,6 +1,6 @@ Date: Sun, 8 Apr 2018 08:49:33 -0600 Subject: [PATCH 170/228] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Update=20config/te?= =?UTF-8?q?st=20depedencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cartfile.private | 8 ++++---- Cartfile.resolved | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cartfile.private b/Cartfile.private index 3a814744e..539a163dd 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -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" >= 0.11.0 +github "Quick/Quick" ~> 1.2.0 +github "Quick/Nimble" ~> 7.0.3 +github "ZipArchive/ZipArchive" ~> 2.1.2 diff --git a/Cartfile.resolved b/Cartfile.resolved index 5ae1e6e22..ade9bcbb9 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -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" "0.11" From 1fc40efe1f2ae6ffc44c186b12fd29a9c0bfe806 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sun, 8 Apr 2018 10:41:49 -0600 Subject: [PATCH 171/228] =?UTF-8?q?=F0=9F=94=A7=20Replace=20partial=20grou?= =?UTF-8?q?p=20with=20script=20folder=20project=20reference?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project.pbxproj | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index fc4b3f8ec..3f8c9c682 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -369,6 +369,7 @@ F8D1BDEF1B31FE7C00CDEC90 /* GTRepository+Pull.h in Headers */ = {isa = PBXBuildFile; fileRef = F8D1BDEC1B31FE7C00CDEC90 /* GTRepository+Pull.h */; settings = {ATTRIBUTES = (Public, ); }; }; F8D1BDF01B31FE7C00CDEC90 /* GTRepository+Pull.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */; }; F8D1BDF11B31FE7C00CDEC90 /* GTRepository+Pull.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */; }; + F8D6384B207A618D00D1FD32 /* script in Resources */ = {isa = PBXBuildFile; fileRef = F8D6384A207A618D00D1FD32 /* script */; }; F8E4A2911A170CA6006485A8 /* GTRemotePushSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8E4A2901A170CA6006485A8 /* GTRemotePushSpec.m */; }; F8E68E731C800B1600DBC517 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8E68E721C800B1600DBC517 /* ZipArchive.framework */; }; F8EFA03A1B4059ED000FF7D0 /* GTUtilityFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0391B4059ED000FF7D0 /* GTUtilityFunctions.m */; }; @@ -505,7 +506,6 @@ 5BE612921745EEBC00266D8C /* GTTreeBuilderSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTTreeBuilderSpec.m; sourceTree = ""; }; 6A1F2FD317C6A8F3003DFADE /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = "External/ios-openssl/lib/libcrypto.a"; sourceTree = ""; }; 6A1F2FD417C6A8F3003DFADE /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = "External/ios-openssl/lib/libssl.a"; sourceTree = ""; }; - 6A3C60A017D5987600382DFF /* update_libssh2_ios */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = update_libssh2_ios; path = script/update_libssh2_ios; sourceTree = SOURCE_ROOT; }; 6A502B8617D6892D00BAF4A5 /* libssh2-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libssh2-ios.a"; path = "External/libssh2-ios/lib/libssh2-ios.a"; sourceTree = ""; }; 6EEB519F199D62B9001D72C0 /* GTFetchHeadEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTFetchHeadEntry.h; sourceTree = ""; }; 6EEB51A0199D62B9001D72C0 /* GTFetchHeadEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTFetchHeadEntry.m; sourceTree = ""; }; @@ -641,8 +641,6 @@ DD3D9511182A81E1004AF532 /* GTBlame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTBlame.m; sourceTree = ""; }; DD3D951A182AB25C004AF532 /* GTBlameHunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTBlameHunk.h; sourceTree = ""; }; DD3D951B182AB25C004AF532 /* GTBlameHunk.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTBlameHunk.m; sourceTree = ""; }; - E46931A7172740D300F2077D /* update_libgit2 */ = {isa = PBXFileReference; lastKnownFileType = text; name = update_libgit2; path = script/update_libgit2; sourceTree = ""; }; - E46931A8172740D300F2077D /* update_libgit2_ios */ = {isa = PBXFileReference; lastKnownFileType = text; name = update_libgit2_ios; path = script/update_libgit2_ios; sourceTree = ""; }; F879D82F1B4B77F4002D5C07 /* Libgit2FeaturesSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Libgit2FeaturesSpec.m; sourceTree = ""; }; F879D8361B4B7F7C002D5C07 /* ObjectiveGit-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ObjectiveGit-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; F879D8461B4B8138002D5C07 /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = "Carthage/Checkouts/Nimble/build/Debug-iphoneos/Nimble.framework"; sourceTree = ""; }; @@ -650,6 +648,7 @@ F8D0078A1B4F9F9E009A8DAF /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; }; F8D1BDEC1B31FE7C00CDEC90 /* GTRepository+Pull.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTRepository+Pull.h"; sourceTree = ""; }; F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+Pull.m"; sourceTree = ""; }; + F8D6384A207A618D00D1FD32 /* script */ = {isa = PBXFileReference; lastKnownFileType = folder; path = script; sourceTree = ""; }; F8E4A2901A170CA6006485A8 /* GTRemotePushSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTRemotePushSpec.m; sourceTree = ""; }; F8E68E721C800B1600DBC517 /* ZipArchive.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZipArchive.framework; path = "Carthage/Checkouts/ZipArchive/build/Debug-iphoneos/ZipArchive.framework"; sourceTree = ""; }; F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+PullSpec.m"; sourceTree = ""; }; @@ -733,7 +732,7 @@ 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, D0D81857174421EB00995A2E /* Configuration */, 034768DFFF38A50411DB9C8B /* Products */, - E46931A6172740D300F2077D /* Scripts */, + F8D6384A207A618D00D1FD32 /* script */, ); name = ObjectiveGitFramework; sourceTree = ""; @@ -1054,16 +1053,6 @@ path = "Mac OS X"; sourceTree = ""; }; - E46931A6172740D300F2077D /* Scripts */ = { - isa = PBXGroup; - children = ( - 6A3C60A017D5987600382DFF /* update_libssh2_ios */, - E46931A7172740D300F2077D /* update_libgit2 */, - E46931A8172740D300F2077D /* update_libgit2_ios */, - ); - path = Scripts; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -1340,6 +1329,7 @@ buildActionMask = 2147483647; files = ( 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, + F8D6384B207A618D00D1FD32 /* script in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; From 3eaf62d62553a51dd5a1b79b950aaeaf1b817f18 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sun, 8 Apr 2018 10:42:11 -0600 Subject: [PATCH 172/228] =?UTF-8?q?=F0=9F=94=A7=20Add=20IDEWorkspaceChecks?= =?UTF-8?q?.plist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 ObjectiveGitFramework.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/ObjectiveGitFramework.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ObjectiveGitFramework.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/ObjectiveGitFramework.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + From cddb8c5094758970803620758d279e070e0471b9 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sun, 8 Apr 2018 10:48:44 -0600 Subject: [PATCH 173/228] =?UTF-8?q?=E2=9A=A0=EF=B8=8F=20Override=20xcconfi?= =?UTF-8?q?g=20"treat=20warnings=20as=20errors"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 3f8c9c682..255368c85 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -1729,6 +1729,7 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; ENABLE_TESTABILITY = YES; GCC_NO_COMMON_BLOCKS = YES; + GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO; HEADER_SEARCH_PATHS = ( External/libgit2/include, @@ -1767,6 +1768,7 @@ CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; GCC_NO_COMMON_BLOCKS = YES; + GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO; HEADER_SEARCH_PATHS = ( External/libgit2/include, @@ -1898,6 +1900,7 @@ CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; GCC_NO_COMMON_BLOCKS = YES; + GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO; HEADER_SEARCH_PATHS = ( External/libgit2/include, @@ -2140,6 +2143,7 @@ CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; GCC_NO_COMMON_BLOCKS = YES; + GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO; HEADER_SEARCH_PATHS = ( External/libgit2/include, From 9d7e8872526594329b4754ba15882942062c3c5c Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sun, 8 Apr 2018 11:33:19 -0600 Subject: [PATCH 174/228] =?UTF-8?q?=F0=9F=91=B7=F0=9F=8F=BB=E2=80=8D?= =?UTF-8?q?=E2=99=80=EF=B8=8F=E2=AC=86=EF=B8=8F=20Update=20travis=20image?= =?UTF-8?q?=20to=20xcode9.3beta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 290c63d1a..d9562096f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,18 +1,31 @@ -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 +# 9.3 beta is latest available as of 2018-04-08 +osx_image: xcode9.3beta language: objective-c + matrix: fast_finish: true include: - - osx_image: xcode8.3 + - osx_image: xcode9.3beta env: - SCHEME="ObjectiveGit Mac" - - osx_image: xcode8.3 + - osx_image: xcode9.3beta env: - SCHEME="ObjectiveGit iOS" + before_install: - gem install xcpretty - gem install xcpretty-travis-formatter install: script/bootstrap script: script/cibuild + notifications: email: false From e9b91b797bf9b32d16e293353febd85d5b707056 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sun, 8 Apr 2018 21:23:21 -0600 Subject: [PATCH 175/228] =?UTF-8?q?=F0=9F=9B=A0=20Update=20linking=20setti?= =?UTF-8?q?ngs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test dependencies are included/build through derived data, so only need to be downloaded with Carthage. --- Cartfile.private | 2 +- Cartfile.resolved | 2 +- Carthage/Checkouts/xcconfigs | 2 +- .../project.pbxproj | 121 +++++++++--------- .../xcschemes/ObjectiveGit Mac.xcscheme | 42 ++++++ .../xcschemes/ObjectiveGit iOS.xcscheme | 44 ++++++- 6 files changed, 145 insertions(+), 68 deletions(-) diff --git a/Cartfile.private b/Cartfile.private index 539a163dd..a1c51bdf2 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,4 +1,4 @@ -github "jspahrsummers/xcconfigs" >= 0.11.0 +github "jspahrsummers/xcconfigs" "master" github "Quick/Quick" ~> 1.2.0 github "Quick/Nimble" ~> 7.0.3 github "ZipArchive/ZipArchive" ~> 2.1.2 diff --git a/Cartfile.resolved b/Cartfile.resolved index ade9bcbb9..22fec494b 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ github "Quick/Nimble" "v7.0.3" github "Quick/Quick" "v1.2.0" github "ZipArchive/ZipArchive" "v2.1.2" -github "jspahrsummers/xcconfigs" "0.11" +github "jspahrsummers/xcconfigs" "bb795558a76e5daf3688500055bbcfe243bffa8d" diff --git a/Carthage/Checkouts/xcconfigs b/Carthage/Checkouts/xcconfigs index 40f9bcc63..bb795558a 160000 --- a/Carthage/Checkouts/xcconfigs +++ b/Carthage/Checkouts/xcconfigs @@ -1 +1 @@ -Subproject commit 40f9bcc63752cdd95deee267d2fbf9da09a9f6f2 +Subproject commit bb795558a76e5daf3688500055bbcfe243bffa8d diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 255368c85..ee33327a5 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -60,7 +60,6 @@ 2089E43C17D9A58000F451DA /* GTTagSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 2089E43B17D9A58000F451DA /* GTTagSpec.m */; }; 20F43DE318A2F668007D3621 /* GTRepository+Blame.h in Headers */ = {isa = PBXBuildFile; fileRef = 20F43DE118A2F667007D3621 /* GTRepository+Blame.h */; settings = {ATTRIBUTES = (Public, ); }; }; 20F43DE618A2F668007D3621 /* GTRepository+Blame.m in Sources */ = {isa = PBXBuildFile; fileRef = 20F43DE218A2F667007D3621 /* GTRepository+Blame.m */; }; - 23BB67BC1C7DF45300A37A66 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BB67BB1C7DF45300A37A66 /* libz.tbd */; }; 23BB67C11C7DF60300A37A66 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; }; 23BB67C21C7DF60400A37A66 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; }; 23F39FAD1C86DB1C00849F3C /* GTRepository+Merging.h in Headers */ = {isa = PBXBuildFile; fileRef = 23F39FAB1C86DB1C00849F3C /* GTRepository+Merging.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -88,7 +87,6 @@ 30DCBA7317B4791A009B0EBD /* NSArray+StringArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 30DCBA7017B4791A009B0EBD /* NSArray+StringArray.m */; }; 30FDC07F16835A8100654BF0 /* GTDiffLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 30FDC07D16835A8100654BF0 /* GTDiffLine.h */; settings = {ATTRIBUTES = (Public, ); }; }; 30FDC08116835A8100654BF0 /* GTDiffLine.m in Sources */ = {isa = PBXBuildFile; fileRef = 30FDC07E16835A8100654BF0 /* GTDiffLine.m */; }; - 4D103ADD1819CFAA0029DB24 /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D103ADC1819CFAA0029DB24 /* libiconv.dylib */; }; 4D123240178E009E0048F785 /* GTRepositoryCommittingSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D12323F178E009E0048F785 /* GTRepositoryCommittingSpec.m */; }; 4D1C40D8182C006D00BE2960 /* GTBlobSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D1C40D7182C006D00BE2960 /* GTBlobSpec.m */; }; 4D79C0EE17DF9F4D00997DE4 /* GTCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D79C0EC17DF9F4D00997DE4 /* GTCredential.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -111,7 +109,6 @@ 6EEB51A2199D62B9001D72C0 /* GTFetchHeadEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EEB51A0199D62B9001D72C0 /* GTFetchHeadEntry.m */; }; 79262F1013C697C100A4B1EA /* git2 in Copy git2 Headers */ = {isa = PBXBuildFile; fileRef = 79262F0E13C697BE00A4B1EA /* git2 */; }; 79262F8B13C69B1600A4B1EA /* git2.h in Headers */ = {isa = PBXBuildFile; fileRef = 79262F8A13C69B1600A4B1EA /* git2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8803DA871313145700E6E818 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8803DA861313145700E6E818 /* libz.dylib */; }; 880EE66118AE700500B82455 /* GTFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 880EE65F18AE700500B82455 /* GTFilter.h */; settings = {ATTRIBUTES = (Public, ); }; }; 880EE66318AE700500B82455 /* GTFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 880EE66018AE700500B82455 /* GTFilter.m */; }; 882154691714740500D76B76 /* GTReflog.h in Headers */ = {isa = PBXBuildFile; fileRef = 882154671714740500D76B76 /* GTReflog.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -126,8 +123,6 @@ 88328128173D8A64006D7DCF /* GTTreeSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 88328127173D8A64006D7DCF /* GTTreeSpec.m */; }; 883CD6AB1600EBC600F57354 /* GTRemote.h in Headers */ = {isa = PBXBuildFile; fileRef = 883CD6A91600EBC600F57354 /* GTRemote.h */; settings = {ATTRIBUTES = (Public, ); }; }; 883CD6AC1600EBC600F57354 /* GTRemote.m in Sources */ = {isa = PBXBuildFile; fileRef = 883CD6AA1600EBC600F57354 /* GTRemote.m */; }; - 884C8A3719FF4B4D0017E98D /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 884C8A3619FF4B4D0017E98D /* libz.dylib */; }; - 884C8A3919FF4B6D0017E98D /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 884C8A3819FF4B6D0017E98D /* libiconv.dylib */; }; 884C8A3A19FF4B890017E98D /* EXTScope.m in Sources */ = {isa = PBXBuildFile; fileRef = 306123AA17EA5261006591D4 /* EXTScope.m */; }; 886E622A18AEBF75000611A0 /* GTFilterSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 886E622818AEBF75000611A0 /* GTFilterSource.h */; settings = {ATTRIBUTES = (Public, ); }; }; 886E622C18AEBF75000611A0 /* GTFilterSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 886E622918AEBF75000611A0 /* GTFilterSource.m */; }; @@ -321,21 +316,21 @@ DD3D9513182A81E1004AF532 /* GTBlame.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3D9511182A81E1004AF532 /* GTBlame.m */; }; DD3D951C182AB25C004AF532 /* GTBlameHunk.h in Headers */ = {isa = PBXBuildFile; fileRef = DD3D951A182AB25C004AF532 /* GTBlameHunk.h */; settings = {ATTRIBUTES = (Public, ); }; }; DD3D951D182AB25C004AF532 /* GTBlameHunk.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3D951B182AB25C004AF532 /* GTBlameHunk.m */; }; + F81B6B50207B032800AB0836 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63871207AE62A00D1FD32 /* XCTest.framework */; }; + F81B6B55207B0A9F00AB0836 /* Mac-XCTest.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = F81B6B54207B0A9F00AB0836 /* Mac-XCTest.xcconfig */; }; + F81B6B59207B0D3B00AB0836 /* SwiftSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0A0129619F9A660007F1914 /* SwiftSpec.swift */; }; + F84277BA207B1002008AB8E8 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63865207ACCAA00D1FD32 /* Nimble.framework */; }; + F84277BE207B104A008AB8E8 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63872207AE63A00D1FD32 /* XCTest.framework */; }; F86949AA1BF1B79E00A989D3 /* GTUtilityFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0391B4059ED000FF7D0 /* GTUtilityFunctions.m */; }; F879D8311B4B788F002D5C07 /* Libgit2FeaturesSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F879D82F1B4B77F4002D5C07 /* Libgit2FeaturesSpec.m */; }; F879D83C1B4B7F7D002D5C07 /* ObjectiveGit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D01B6ED319F82E2000D411BC /* ObjectiveGit.framework */; }; F879D8441B4B80C7002D5C07 /* Libgit2FeaturesSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F879D82F1B4B77F4002D5C07 /* Libgit2FeaturesSpec.m */; }; - F879D8451B4B8138002D5C07 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0A0128819F98475007F1914 /* Quick.framework */; }; - F879D8471B4B8138002D5C07 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F879D8461B4B8138002D5C07 /* Nimble.framework */; }; - F879D8481B4B83B9002D5C07 /* SwiftSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0A0129619F9A660007F1914 /* SwiftSpec.swift */; }; - F895F4DF1C801E5F004EA221 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F895F4DE1C801E5F004EA221 /* ZipArchive.framework */; }; F8D007701B4F7CA8009A8DAF /* NSErrorGitSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F4E28917C7F24200BBDE30 /* NSErrorGitSpec.m */; }; F8D007711B4F7CB0009A8DAF /* NSDataGitSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D01EFD9F195DEF2200838D24 /* NSDataGitSpec.m */; }; F8D007721B4F7CB6009A8DAF /* NSArray+StringArraySpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 307623AA17C6C8BD00E2CDF1 /* NSArray+StringArraySpec.m */; }; F8D007731B4F7CC3009A8DAF /* GTSignatureSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D040AF77177B9A9E001AD9EB /* GTSignatureSpec.m */; }; F8D007741B4F7CCC009A8DAF /* GTOIDSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D040AF6F177B9779001AD9EB /* GTOIDSpec.m */; }; F8D007761B4F7D10009A8DAF /* GTTimeAdditionsSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 30B1E7FF1703871900D0814D /* GTTimeAdditionsSpec.m */; }; - F8D0078B1B4F9F9E009A8DAF /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D0078A1B4F9F9E009A8DAF /* libz.dylib */; }; F8D0078C1B4FA03B009A8DAF /* GTBlobSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D1C40D7182C006D00BE2960 /* GTBlobSpec.m */; }; F8D0078D1B4FA03B009A8DAF /* GTBranchSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 88A994B916FCE7D400402C7B /* GTBranchSpec.m */; }; F8D0078E1B4FA03B009A8DAF /* GTCommitSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F05AA416011FFD00B7AD1D /* GTCommitSpec.m */; }; @@ -370,8 +365,14 @@ F8D1BDF01B31FE7C00CDEC90 /* GTRepository+Pull.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */; }; F8D1BDF11B31FE7C00CDEC90 /* GTRepository+Pull.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */; }; F8D6384B207A618D00D1FD32 /* script in Resources */ = {isa = PBXBuildFile; fileRef = F8D6384A207A618D00D1FD32 /* script */; }; + F8D6385C207AC74A00D1FD32 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D6385B207AC74A00D1FD32 /* libiconv.tbd */; }; + F8D6385D207AC75100D1FD32 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BB67BB1C7DF45300A37A66 /* libz.tbd */; }; + F8D6385F207ACAE600D1FD32 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D6385E207ACAE600D1FD32 /* libz.tbd */; }; + F8D63861207ACAF700D1FD32 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63860207ACAF600D1FD32 /* libiconv.tbd */; }; + F8D63868207ACCEE00D1FD32 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63867207ACCEE00D1FD32 /* Quick.framework */; }; + F8D6386A207ACDDD00D1FD32 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63869207ACDDD00D1FD32 /* ZipArchive.framework */; }; + F8D6386C207ACE0600D1FD32 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D6386B207ACE0600D1FD32 /* ZipArchive.framework */; }; F8E4A2911A170CA6006485A8 /* GTRemotePushSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8E4A2901A170CA6006485A8 /* GTRemotePushSpec.m */; }; - F8E68E731C800B1600DBC517 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8E68E721C800B1600DBC517 /* ZipArchive.framework */; }; F8EFA03A1B4059ED000FF7D0 /* GTUtilityFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0391B4059ED000FF7D0 /* GTUtilityFunctions.m */; }; F964D5F11CE9D9B200F1D8DD /* GTNote.h in Headers */ = {isa = PBXBuildFile; fileRef = F964D5EF1CE9D9B200F1D8DD /* GTNote.h */; settings = {ATTRIBUTES = (Public, ); }; }; F964D5F21CE9D9B200F1D8DD /* GTNote.h in Headers */ = {isa = PBXBuildFile; fileRef = F964D5EF1CE9D9B200F1D8DD /* GTNote.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -485,7 +486,6 @@ 30DCBA7017B4791A009B0EBD /* NSArray+StringArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+StringArray.m"; sourceTree = ""; }; 30FDC07D16835A8100654BF0 /* GTDiffLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTDiffLine.h; sourceTree = ""; }; 30FDC07E16835A8100654BF0 /* GTDiffLine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTDiffLine.m; sourceTree = ""; }; - 4D103ADC1819CFAA0029DB24 /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = usr/lib/libiconv.dylib; sourceTree = SDKROOT; }; 4D12323F178E009E0048F785 /* GTRepositoryCommittingSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTRepositoryCommittingSpec.m; sourceTree = ""; }; 4D1C40D7182C006D00BE2960 /* GTBlobSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTBlobSpec.m; sourceTree = ""; }; 4D79C0EC17DF9F4D00997DE4 /* GTCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTCredential.h; sourceTree = ""; }; @@ -511,7 +511,6 @@ 6EEB51A0199D62B9001D72C0 /* GTFetchHeadEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTFetchHeadEntry.m; sourceTree = ""; }; 79262F0E13C697BE00A4B1EA /* git2 */ = {isa = PBXFileReference; lastKnownFileType = folder; name = git2; path = External/libgit2/include/git2; sourceTree = ""; }; 79262F8A13C69B1600A4B1EA /* git2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = git2.h; path = External/libgit2/include/git2.h; sourceTree = ""; }; - 8803DA861313145700E6E818 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 880EE65F18AE700500B82455 /* GTFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTFilter.h; sourceTree = ""; }; 880EE66018AE700500B82455 /* GTFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTFilter.m; sourceTree = ""; }; 882154671714740500D76B76 /* GTReflog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTReflog.h; sourceTree = ""; }; @@ -529,8 +528,6 @@ 883CD6A91600EBC600F57354 /* GTRemote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTRemote.h; sourceTree = ""; }; 883CD6AA1600EBC600F57354 /* GTRemote.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTRemote.m; sourceTree = ""; }; 883CD6AE1600F01000F57354 /* GTConfiguration+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GTConfiguration+Private.h"; sourceTree = ""; }; - 884C8A3619FF4B4D0017E98D /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; }; - 884C8A3819FF4B6D0017E98D /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/usr/lib/libiconv.dylib; sourceTree = DEVELOPER_DIR; }; 886E622818AEBF75000611A0 /* GTFilterSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTFilterSource.h; sourceTree = ""; }; 886E622918AEBF75000611A0 /* GTFilterSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTFilterSource.m; sourceTree = ""; }; 886E623618AECD86000611A0 /* GTFilterSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTFilterSpec.m; sourceTree = ""; }; @@ -615,7 +612,7 @@ D09C2E351755F16200065E36 /* GTSubmodule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTSubmodule.m; sourceTree = ""; }; D09C2E50175602A500065E36 /* fixtures.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = fixtures.zip; path = fixtures/fixtures.zip; sourceTree = ""; }; D0A0128819F98475007F1914 /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Quick.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - D0A0128B19F9853D007F1914 /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0A0128B19F9853D007F1914 /* Nimble.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D0A0129619F9A660007F1914 /* SwiftSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftSpec.swift; sourceTree = ""; }; D0A463D617E57C45000F5021 /* Common.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Common.xcconfig; sourceTree = ""; }; D0A463D817E57C45000F5021 /* Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; @@ -641,16 +638,24 @@ DD3D9511182A81E1004AF532 /* GTBlame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTBlame.m; sourceTree = ""; }; DD3D951A182AB25C004AF532 /* GTBlameHunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTBlameHunk.h; sourceTree = ""; }; DD3D951B182AB25C004AF532 /* GTBlameHunk.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTBlameHunk.m; sourceTree = ""; }; + F81B6B51207B0A7700AB0836 /* Extension.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Extension.xcconfig; sourceTree = ""; }; + F81B6B53207B0A8B00AB0836 /* iOS-Extension.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "iOS-Extension.xcconfig"; sourceTree = ""; }; + F81B6B54207B0A9F00AB0836 /* Mac-XCTest.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Mac-XCTest.xcconfig"; sourceTree = ""; }; F879D82F1B4B77F4002D5C07 /* Libgit2FeaturesSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Libgit2FeaturesSpec.m; sourceTree = ""; }; F879D8361B4B7F7C002D5C07 /* ObjectiveGit-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ObjectiveGit-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - F879D8461B4B8138002D5C07 /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = "Carthage/Checkouts/Nimble/build/Debug-iphoneos/Nimble.framework"; sourceTree = ""; }; - F895F4DE1C801E5F004EA221 /* ZipArchive.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZipArchive.framework; path = "/Volumes/DerivedData/ObjectiveGitFramework-drtqacfhlqybdcdpqayztrrwneun/Build/Products/Debug/ZipArchive.framework"; sourceTree = ""; }; - F8D0078A1B4F9F9E009A8DAF /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; }; F8D1BDEC1B31FE7C00CDEC90 /* GTRepository+Pull.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTRepository+Pull.h"; sourceTree = ""; }; F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+Pull.m"; sourceTree = ""; }; F8D6384A207A618D00D1FD32 /* script */ = {isa = PBXFileReference; lastKnownFileType = folder; path = script; sourceTree = ""; }; + F8D6385B207AC74A00D1FD32 /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = usr/lib/libiconv.tbd; sourceTree = SDKROOT; }; + F8D6385E207ACAE600D1FD32 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; }; + F8D63860207ACAF600D1FD32 /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/usr/lib/libiconv.tbd; sourceTree = DEVELOPER_DIR; }; + F8D63865207ACCAA00D1FD32 /* Nimble.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Nimble.framework; path = "../Debug-iphonesimulator/Nimble.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + F8D63867207ACCEE00D1FD32 /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = "../Debug-iphonesimulator/Quick.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + F8D63869207ACDDD00D1FD32 /* ZipArchive.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZipArchive.framework; path = "../Debug-iphonesimulator/ZipArchive.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + F8D6386B207ACE0600D1FD32 /* ZipArchive.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ZipArchive.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F8D63871207AE62A00D1FD32 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; + F8D63872207AE63A00D1FD32 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; F8E4A2901A170CA6006485A8 /* GTRemotePushSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTRemotePushSpec.m; sourceTree = ""; }; - F8E68E721C800B1600DBC517 /* ZipArchive.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZipArchive.framework; path = "Carthage/Checkouts/ZipArchive/build/Debug-iphoneos/ZipArchive.framework"; sourceTree = ""; }; F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+PullSpec.m"; sourceTree = ""; }; F8EFA0381B4059ED000FF7D0 /* GTUtilityFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTUtilityFunctions.h; sourceTree = ""; }; F8EFA0391B4059ED000FF7D0 /* GTUtilityFunctions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTUtilityFunctions.m; sourceTree = ""; }; @@ -664,11 +669,11 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 23BB67BC1C7DF45300A37A66 /* libz.tbd in Frameworks */, + F81B6B50207B032800AB0836 /* XCTest.framework in Frameworks */, D0A0128A19F98475007F1914 /* Quick.framework in Frameworks */, 88F05A9E16011F6E00B7AD1D /* ObjectiveGit.framework in Frameworks */, D0A0128C19F9853D007F1914 /* Nimble.framework in Frameworks */, - F895F4DF1C801E5F004EA221 /* ZipArchive.framework in Frameworks */, + F8D6386C207ACE0600D1FD32 /* ZipArchive.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -676,9 +681,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4D103ADD1819CFAA0029DB24 /* libiconv.dylib in Frameworks */, + F8D6385D207AC75100D1FD32 /* libz.tbd in Frameworks */, + F8D6385C207AC74A00D1FD32 /* libiconv.tbd in Frameworks */, 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */, - 8803DA871313145700E6E818 /* libz.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -686,9 +691,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 884C8A3919FF4B6D0017E98D /* libiconv.dylib in Frameworks */, - 884C8A3719FF4B4D0017E98D /* libz.dylib in Frameworks */, + F8D63861207ACAF700D1FD32 /* libiconv.tbd in Frameworks */, + F8D6385F207ACAE600D1FD32 /* libz.tbd in Frameworks */, D05FC5E319FAD03C008C9348 /* libssl.a in Frameworks */, + F84277BA207B1002008AB8E8 /* Nimble.framework in Frameworks */, D05FC5E219FAD039008C9348 /* libcrypto.a in Frameworks */, D05FC5E419FAD040008C9348 /* libssh2-ios.a in Frameworks */, ); @@ -698,11 +704,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F8D0078B1B4F9F9E009A8DAF /* libz.dylib in Frameworks */, - F879D8471B4B8138002D5C07 /* Nimble.framework in Frameworks */, - F879D8451B4B8138002D5C07 /* Quick.framework in Frameworks */, + F84277BE207B104A008AB8E8 /* XCTest.framework in Frameworks */, + F8D63868207ACCEE00D1FD32 /* Quick.framework in Frameworks */, F879D83C1B4B7F7D002D5C07 /* ObjectiveGit.framework in Frameworks */, - F8E68E731C800B1600DBC517 /* ZipArchive.framework in Frameworks */, + F8D6386A207ACDDD00D1FD32 /* ZipArchive.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -741,24 +746,25 @@ 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { isa = PBXGroup; children = ( + 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, 306123A817EA5261006591D4 /* extobjc */, - 4D103ADC1819CFAA0029DB24 /* libiconv.dylib */, - 8803DA861313145700E6E818 /* libz.dylib */, - F8D0078A1B4F9F9E009A8DAF /* libz.dylib */, - 884C8A3619FF4B4D0017E98D /* libz.dylib */, - 23BB67BB1C7DF45300A37A66 /* libz.tbd */, - 884C8A3819FF4B6D0017E98D /* libiconv.dylib */, + 889923F919FF5DD40092A9A6 /* git2 */, 6A1F2FD317C6A8F3003DFADE /* libcrypto.a */, - 6A1F2FD417C6A8F3003DFADE /* libssl.a */, + F8D63860207ACAF600D1FD32 /* libiconv.tbd */, + F8D6385B207AC74A00D1FD32 /* libiconv.tbd */, 6A502B8617D6892D00BAF4A5 /* libssh2-ios.a */, - 887DAFF615CB1C8000F30D0D /* Security.framework */, - 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, - D0A0128819F98475007F1914 /* Quick.framework */, + 6A1F2FD417C6A8F3003DFADE /* libssl.a */, + 23BB67BB1C7DF45300A37A66 /* libz.tbd */, + F8D6385E207ACAE600D1FD32 /* libz.tbd */, D0A0128B19F9853D007F1914 /* Nimble.framework */, - F879D8461B4B8138002D5C07 /* Nimble.framework */, - 889923F919FF5DD40092A9A6 /* git2 */, - F895F4DE1C801E5F004EA221 /* ZipArchive.framework */, - F8E68E721C800B1600DBC517 /* ZipArchive.framework */, + F8D63865207ACCAA00D1FD32 /* Nimble.framework */, + D0A0128819F98475007F1914 /* Quick.framework */, + F8D63867207ACCEE00D1FD32 /* Quick.framework */, + 887DAFF615CB1C8000F30D0D /* Security.framework */, + F8D63871207AE62A00D1FD32 /* XCTest.framework */, + F8D63872207AE63A00D1FD32 /* XCTest.framework */, + F8D6386B207ACE0600D1FD32 /* ZipArchive.framework */, + F8D63869207ACDDD00D1FD32 /* ZipArchive.framework */, ); name = "External Frameworks and Libraries"; sourceTree = ""; @@ -1012,6 +1018,7 @@ isa = PBXGroup; children = ( D0A463DD17E57C45000F5021 /* Application.xcconfig */, + F81B6B51207B0A7700AB0836 /* Extension.xcconfig */, D019778B19F830CC00F523DA /* Framework.xcconfig */, D0A463DE17E57C45000F5021 /* StaticLibrary.xcconfig */, ); @@ -1035,6 +1042,7 @@ children = ( D0D81863174421EB00995A2E /* iOS-Application.xcconfig */, D0D81864174421EB00995A2E /* iOS-Base.xcconfig */, + F81B6B53207B0A8B00AB0836 /* iOS-Extension.xcconfig */, D019778C19F830D100F523DA /* iOS-Framework.xcconfig */, D0D81865174421EB00995A2E /* iOS-StaticLibrary.xcconfig */, ); @@ -1049,6 +1057,7 @@ D0D81869174421EB00995A2E /* Mac-DynamicLibrary.xcconfig */, D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */, D0D8186B174421EB00995A2E /* Mac-StaticLibrary.xcconfig */, + F81B6B54207B0A9F00AB0836 /* Mac-XCTest.xcconfig */, ); path = "Mac OS X"; sourceTree = ""; @@ -1330,6 +1339,7 @@ files = ( 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, F8D6384B207A618D00D1FD32 /* script in Resources */, + F81B6B55207B0A9F00AB0836 /* Mac-XCTest.xcconfig in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1589,6 +1599,7 @@ F8D007721B4F7CB6009A8DAF /* NSArray+StringArraySpec.m in Sources */, F8D007731B4F7CC3009A8DAF /* GTSignatureSpec.m in Sources */, F8D007A21B4FA03B009A8DAF /* GTFilterSpec.m in Sources */, + F81B6B59207B0D3B00AB0836 /* SwiftSpec.swift in Sources */, F8D007971B4FA03B009A8DAF /* GTRemoteSpec.m in Sources */, F8D007A61B4FA03B009A8DAF /* GTRepositoryAttributesSpec.m in Sources */, F8D007941B4FA03B009A8DAF /* GTReferenceSpec.m in Sources */, @@ -1614,7 +1625,6 @@ F8D007A01B4FA03B009A8DAF /* GTRepository+StatusSpec.m in Sources */, F8D007961B4FA03B009A8DAF /* GTRemotePushSpec.m in Sources */, F8D007A51B4FA03B009A8DAF /* GTDiffDeltaSpec.m in Sources */, - F879D8481B4B83B9002D5C07 /* SwiftSpec.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1669,7 +1679,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */; buildSettings = { - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; @@ -1694,7 +1703,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */; buildSettings = { - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; @@ -1784,7 +1792,6 @@ "$(inherited)", "-DGIT_SSH", ); - SWIFT_COMPILATION_MODE = wholemodule; SWIFT_VERSION = 2.3; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( @@ -1844,7 +1851,7 @@ }; 88F05A8016011E5400B7AD1D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D0D81867174421EB00995A2E /* Mac-Application.xcconfig */; + baseConfigurationReference = F81B6B54207B0A9F00AB0836 /* Mac-XCTest.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1929,7 +1936,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */; buildSettings = { - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; @@ -1952,7 +1958,7 @@ }; D019778F19F830F500F523DA /* Test */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D0D81867174421EB00995A2E /* Mac-Application.xcconfig */; + baseConfigurationReference = F81B6B54207B0A9F00AB0836 /* Mac-XCTest.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -2172,7 +2178,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */; buildSettings = { - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; @@ -2267,8 +2272,6 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -2281,7 +2284,6 @@ COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -2322,8 +2324,6 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -2337,7 +2337,6 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -2370,8 +2369,6 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -2385,7 +2382,6 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -2419,8 +2415,6 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -2434,7 +2428,6 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; diff --git a/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme b/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme index 7ce4c723f..2e7f2c268 100644 --- a/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme +++ b/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme @@ -34,6 +34,48 @@ ReferencedContainer = "container:ObjectiveGitFramework.xcodeproj"> + + + + + + + + + + + + + + + + + + + + + + + + Date: Sun, 8 Apr 2018 21:25:39 -0600 Subject: [PATCH 176/228] =?UTF-8?q?=F0=9F=94=A7=20Swift=204.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index ee33327a5..08c191811 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -1292,7 +1292,7 @@ }; F879D8351B4B7F7C002D5C07 = { CreatedOnToolsVersion = 6.4; - LastSwiftMigration = 0830; + LastSwiftMigration = 0930; }; }; }; @@ -2314,7 +2314,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -2358,7 +2358,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; VALIDATE_PRODUCT = YES; }; name = Test; @@ -2404,7 +2404,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -2449,7 +2449,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; VALIDATE_PRODUCT = YES; }; name = Profile; From 3a0b7da62b7b019b7dd7ba7fda9fdfc60072d238 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sun, 8 Apr 2018 21:29:53 -0600 Subject: [PATCH 177/228] =?UTF-8?q?=F0=9F=8E=A8=20Clean=20up=20imports=20i?= =?UTF-8?q?n=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 4 ++-- ObjectiveGitTests/GTBlameSpec.m | 6 +++--- ObjectiveGitTests/GTBlobSpec.m | 6 +++--- ObjectiveGitTests/GTBranchSpec.m | 7 +++---- ObjectiveGitTests/GTCommitSpec.m | 6 +++--- ObjectiveGitTests/GTConfigurationSpec.m | 6 +++--- ObjectiveGitTests/GTDiffDeltaSpec.m | 6 +++--- ObjectiveGitTests/GTDiffSpec.m | 6 +++--- ObjectiveGitTests/GTEnumeratorSpec.m | 6 +++--- ObjectiveGitTests/GTFilterListSpec.m | 6 +++--- ObjectiveGitTests/GTFilterSpec.m | 6 +++--- ObjectiveGitTests/GTIndexSpec.m | 6 +++--- ObjectiveGitTests/GTNoteSpec.m | 6 +++--- ObjectiveGitTests/GTOIDSpec.m | 6 +++--- ObjectiveGitTests/GTObjectDatabaseSpec.m | 6 +++--- ObjectiveGitTests/GTObjectSpec.m | 5 +++-- ObjectiveGitTests/GTReferenceSpec.m | 6 +++--- ObjectiveGitTests/GTReflogSpec.m | 6 +++--- ObjectiveGitTests/GTRemotePushSpec.m | 6 +++--- ObjectiveGitTests/GTRemoteSpec.m | 6 +++--- ObjectiveGitTests/GTRepository+PullSpec.m | 7 +++---- ObjectiveGitTests/GTRepository+StatusSpec.m | 6 +++--- ObjectiveGitTests/GTRepositoryAttributesSpec.m | 6 +++--- ObjectiveGitTests/GTRepositoryCommittingSpec.m | 6 +++--- ObjectiveGitTests/GTRepositoryResetSpec.m | 6 +++--- ObjectiveGitTests/GTRepositorySpec.m | 6 +++--- ObjectiveGitTests/GTRepositoryStashingSpec.m | 6 +++--- ObjectiveGitTests/GTSignatureSpec.m | 6 +++--- ObjectiveGitTests/GTSubmoduleSpec.m | 6 +++--- ObjectiveGitTests/GTTagSpec.m | 6 +++--- ObjectiveGitTests/GTTimeAdditionsSpec.m | 6 +++--- ObjectiveGitTests/GTTreeBuilderSpec.m | 6 +++--- ObjectiveGitTests/GTTreeSpec.m | 6 +++--- ObjectiveGitTests/GTUtilityFunctions.h | 8 +++----- ObjectiveGitTests/GTUtilityFunctions.m | 6 +++--- ObjectiveGitTests/Libgit2FeaturesSpec.m | 7 +++---- ObjectiveGitTests/NSArray+StringArraySpec.m | 6 +++--- ObjectiveGitTests/NSDataGitSpec.m | 6 +++--- ObjectiveGitTests/NSErrorGitSpec.m | 6 +++--- ObjectiveGitTests/QuickSpec+GTFixtures.h | 4 +++- ObjectiveGitTests/QuickSpec+GTFixtures.m | 8 +++++--- ObjectiveGitTests/SwiftSpec.swift | 5 +++-- 42 files changed, 127 insertions(+), 126 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 08c191811..d0f88e2c5 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -826,11 +826,13 @@ 88A994B916FCE7D400402C7B /* GTBranchSpec.m */, 88F05AA416011FFD00B7AD1D /* GTCommitSpec.m */, 88C0BC5817038CF3009E99AA /* GTConfigurationSpec.m */, + 8870390A1975E3F2004118D7 /* GTDiffDeltaSpec.m */, 30865A90167F503400B1AB6E /* GTDiffSpec.m */, D06D9E001755D10000558C17 /* GTEnumeratorSpec.m */, D0751CD818BE520400134314 /* GTFilterListSpec.m */, 886E623618AECD86000611A0 /* GTFilterSpec.m */, 8832811E173D8816006D7DCF /* GTIndexSpec.m */, + F9D1D4221CEB79D1009E5855 /* GTNoteSpec.m */, 88948AC81779243600809CDA /* GTObjectDatabaseSpec.m */, 88F05AA816011FFD00B7AD1D /* GTObjectSpec.m */, D040AF6F177B9779001AD9EB /* GTOIDSpec.m */, @@ -842,7 +844,6 @@ 30A269AC17B4878C000FE64E /* GTRepository+StatusSpec.m */, 88E353051982EA6B0051001F /* GTRepositoryAttributesSpec.m */, 4D12323F178E009E0048F785 /* GTRepositoryCommittingSpec.m */, - F9D1D4221CEB79D1009E5855 /* GTNoteSpec.m */, 88234B2518F2FE260039972E /* GTRepositoryResetSpec.m */, D0AC906B172F941F00347DC4 /* GTRepositorySpec.m */, D015F7D417F6965400AD5E1F /* GTRepositoryStashingSpec.m */, @@ -855,7 +856,6 @@ F879D82F1B4B77F4002D5C07 /* Libgit2FeaturesSpec.m */, 307623AA17C6C8BD00E2CDF1 /* NSArray+StringArraySpec.m */, D01EFD9F195DEF2200838D24 /* NSDataGitSpec.m */, - 8870390A1975E3F2004118D7 /* GTDiffDeltaSpec.m */, D0F4E28917C7F24200BBDE30 /* NSErrorGitSpec.m */, 88F05A7616011E5400B7AD1D /* Supporting Files */, ); diff --git a/ObjectiveGitTests/GTBlameSpec.m b/ObjectiveGitTests/GTBlameSpec.m index 8cd8a8225..2cbeec1a4 100644 --- a/ObjectiveGitTests/GTBlameSpec.m +++ b/ObjectiveGitTests/GTBlameSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2014 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTBlobSpec.m b/ObjectiveGitTests/GTBlobSpec.m index fed7020ca..97e735337 100644 --- a/ObjectiveGitTests/GTBlobSpec.m +++ b/ObjectiveGitTests/GTBlobSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTBranchSpec.m b/ObjectiveGitTests/GTBranchSpec.m index f143a03e7..2b997e222 100644 --- a/ObjectiveGitTests/GTBranchSpec.m +++ b/ObjectiveGitTests/GTBranchSpec.m @@ -6,10 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTCommitSpec.m b/ObjectiveGitTests/GTCommitSpec.m index af4e8fc5c..38ebe87ff 100644 --- a/ObjectiveGitTests/GTCommitSpec.m +++ b/ObjectiveGitTests/GTCommitSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTConfigurationSpec.m b/ObjectiveGitTests/GTConfigurationSpec.m index c225a04ec..25f3c1248 100644 --- a/ObjectiveGitTests/GTConfigurationSpec.m +++ b/ObjectiveGitTests/GTConfigurationSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTDiffDeltaSpec.m b/ObjectiveGitTests/GTDiffDeltaSpec.m index e326861f5..81c1ae0e0 100644 --- a/ObjectiveGitTests/GTDiffDeltaSpec.m +++ b/ObjectiveGitTests/GTDiffDeltaSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2014 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTDiffSpec.m b/ObjectiveGitTests/GTDiffSpec.m index 33718a24e..0ad3eea82 100644 --- a/ObjectiveGitTests/GTDiffSpec.m +++ b/ObjectiveGitTests/GTDiffSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2012 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTEnumeratorSpec.m b/ObjectiveGitTests/GTEnumeratorSpec.m index e9ec1649a..70f4e4784 100644 --- a/ObjectiveGitTests/GTEnumeratorSpec.m +++ b/ObjectiveGitTests/GTEnumeratorSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTFilterListSpec.m b/ObjectiveGitTests/GTFilterListSpec.m index f093dfe0c..97313a562 100644 --- a/ObjectiveGitTests/GTFilterListSpec.m +++ b/ObjectiveGitTests/GTFilterListSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2014 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTFilterSpec.m b/ObjectiveGitTests/GTFilterSpec.m index 318a514a2..7ab7a5597 100644 --- a/ObjectiveGitTests/GTFilterSpec.m +++ b/ObjectiveGitTests/GTFilterSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2014 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTIndexSpec.m b/ObjectiveGitTests/GTIndexSpec.m index 1dddd2170..4e894153a 100644 --- a/ObjectiveGitTests/GTIndexSpec.m +++ b/ObjectiveGitTests/GTIndexSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTNoteSpec.m b/ObjectiveGitTests/GTNoteSpec.m index e2d225108..3f977df5c 100644 --- a/ObjectiveGitTests/GTNoteSpec.m +++ b/ObjectiveGitTests/GTNoteSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2016 Wildbit LLC. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTOIDSpec.m b/ObjectiveGitTests/GTOIDSpec.m index a2aa43ab5..ae9421a1f 100644 --- a/ObjectiveGitTests/GTOIDSpec.m +++ b/ObjectiveGitTests/GTOIDSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTObjectDatabaseSpec.m b/ObjectiveGitTests/GTObjectDatabaseSpec.m index f68ed056f..654a06fc8 100644 --- a/ObjectiveGitTests/GTObjectDatabaseSpec.m +++ b/ObjectiveGitTests/GTObjectDatabaseSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTObjectSpec.m b/ObjectiveGitTests/GTObjectSpec.m index c8e89ea0a..677b9c5d2 100644 --- a/ObjectiveGitTests/GTObjectSpec.m +++ b/ObjectiveGitTests/GTObjectSpec.m @@ -27,8 +27,9 @@ // THE SOFTWARE. // -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTReferenceSpec.m b/ObjectiveGitTests/GTReferenceSpec.m index e54b741c8..811a7e952 100644 --- a/ObjectiveGitTests/GTReferenceSpec.m +++ b/ObjectiveGitTests/GTReferenceSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTReflogSpec.m b/ObjectiveGitTests/GTReflogSpec.m index dbd484f1f..cc4bd022b 100644 --- a/ObjectiveGitTests/GTReflogSpec.m +++ b/ObjectiveGitTests/GTReflogSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTRemotePushSpec.m b/ObjectiveGitTests/GTRemotePushSpec.m index 4c14f946a..a4c4af331 100644 --- a/ObjectiveGitTests/GTRemotePushSpec.m +++ b/ObjectiveGitTests/GTRemotePushSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2014 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" #import "GTUtilityFunctions.h" diff --git a/ObjectiveGitTests/GTRemoteSpec.m b/ObjectiveGitTests/GTRemoteSpec.m index 5f8449ca8..e7ac77891 100644 --- a/ObjectiveGitTests/GTRemoteSpec.m +++ b/ObjectiveGitTests/GTRemoteSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" #import "GTUtilityFunctions.h" diff --git a/ObjectiveGitTests/GTRepository+PullSpec.m b/ObjectiveGitTests/GTRepository+PullSpec.m index bb157454d..3c36ebde6 100644 --- a/ObjectiveGitTests/GTRepository+PullSpec.m +++ b/ObjectiveGitTests/GTRepository+PullSpec.m @@ -6,10 +6,9 @@ // Copyright (c) 2015 GitHub, Inc. All rights reserved. // -#import -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" #import "GTUtilityFunctions.h" diff --git a/ObjectiveGitTests/GTRepository+StatusSpec.m b/ObjectiveGitTests/GTRepository+StatusSpec.m index 0786728e0..c2ceaa9cb 100644 --- a/ObjectiveGitTests/GTRepository+StatusSpec.m +++ b/ObjectiveGitTests/GTRepository+StatusSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTRepositoryAttributesSpec.m b/ObjectiveGitTests/GTRepositoryAttributesSpec.m index 5e4ed7465..e60737eb0 100644 --- a/ObjectiveGitTests/GTRepositoryAttributesSpec.m +++ b/ObjectiveGitTests/GTRepositoryAttributesSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2014 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTRepositoryCommittingSpec.m b/ObjectiveGitTests/GTRepositoryCommittingSpec.m index a41e2f078..8e0ffa3f8 100644 --- a/ObjectiveGitTests/GTRepositoryCommittingSpec.m +++ b/ObjectiveGitTests/GTRepositoryCommittingSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTRepositoryResetSpec.m b/ObjectiveGitTests/GTRepositoryResetSpec.m index 241f4807c..eab048715 100644 --- a/ObjectiveGitTests/GTRepositoryResetSpec.m +++ b/ObjectiveGitTests/GTRepositoryResetSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2014 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTRepositorySpec.m b/ObjectiveGitTests/GTRepositorySpec.m index cef89f86e..b21e5d599 100644 --- a/ObjectiveGitTests/GTRepositorySpec.m +++ b/ObjectiveGitTests/GTRepositorySpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTRepositoryStashingSpec.m b/ObjectiveGitTests/GTRepositoryStashingSpec.m index e3e7ffc29..4b5891e56 100644 --- a/ObjectiveGitTests/GTRepositoryStashingSpec.m +++ b/ObjectiveGitTests/GTRepositoryStashingSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTSignatureSpec.m b/ObjectiveGitTests/GTSignatureSpec.m index 86dce667c..17281a0b1 100644 --- a/ObjectiveGitTests/GTSignatureSpec.m +++ b/ObjectiveGitTests/GTSignatureSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTSubmoduleSpec.m b/ObjectiveGitTests/GTSubmoduleSpec.m index d246b1507..0a25f5e35 100644 --- a/ObjectiveGitTests/GTSubmoduleSpec.m +++ b/ObjectiveGitTests/GTSubmoduleSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTTagSpec.m b/ObjectiveGitTests/GTTagSpec.m index 93b26e2f6..bdbb5a5b4 100644 --- a/ObjectiveGitTests/GTTagSpec.m +++ b/ObjectiveGitTests/GTTagSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTTimeAdditionsSpec.m b/ObjectiveGitTests/GTTimeAdditionsSpec.m index c63cb9dbf..21c649141 100644 --- a/ObjectiveGitTests/GTTimeAdditionsSpec.m +++ b/ObjectiveGitTests/GTTimeAdditionsSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTTreeBuilderSpec.m b/ObjectiveGitTests/GTTreeBuilderSpec.m index 547a9b149..4c0d9a3b1 100644 --- a/ObjectiveGitTests/GTTreeBuilderSpec.m +++ b/ObjectiveGitTests/GTTreeBuilderSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 Johnnie Walker // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTTreeSpec.m b/ObjectiveGitTests/GTTreeSpec.m index 9f5cebeed..70a1c10d2 100644 --- a/ObjectiveGitTests/GTTreeSpec.m +++ b/ObjectiveGitTests/GTTreeSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/GTUtilityFunctions.h b/ObjectiveGitTests/GTUtilityFunctions.h index 73741692e..721d62a5d 100644 --- a/ObjectiveGitTests/GTUtilityFunctions.h +++ b/ObjectiveGitTests/GTUtilityFunctions.h @@ -6,11 +6,9 @@ // Copyright (c) 2015 GitHub, Inc. All rights reserved. // -#import -#import -#import - -@import Foundation; +@import ObjectiveGit; +@import Nimble; +@import Quick; @class GTBranch; @class GTCommit; diff --git a/ObjectiveGitTests/GTUtilityFunctions.m b/ObjectiveGitTests/GTUtilityFunctions.m index f6fbe4e46..a09b1ce6e 100644 --- a/ObjectiveGitTests/GTUtilityFunctions.m +++ b/ObjectiveGitTests/GTUtilityFunctions.m @@ -6,9 +6,9 @@ // Copyright (c) 2015 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "GTUtilityFunctions.h" diff --git a/ObjectiveGitTests/Libgit2FeaturesSpec.m b/ObjectiveGitTests/Libgit2FeaturesSpec.m index ba6ec2781..d1898975d 100644 --- a/ObjectiveGitTests/Libgit2FeaturesSpec.m +++ b/ObjectiveGitTests/Libgit2FeaturesSpec.m @@ -6,10 +6,9 @@ // Copyright (c) 2015 GitHub, Inc. All rights reserved. // -#import -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/NSArray+StringArraySpec.m b/ObjectiveGitTests/NSArray+StringArraySpec.m index 6a2e903ec..757e86425 100644 --- a/ObjectiveGitTests/NSArray+StringArraySpec.m +++ b/ObjectiveGitTests/NSArray+StringArraySpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/NSDataGitSpec.m b/ObjectiveGitTests/NSDataGitSpec.m index bc3c4fe37..bc54ea77a 100644 --- a/ObjectiveGitTests/NSDataGitSpec.m +++ b/ObjectiveGitTests/NSDataGitSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2014 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/NSErrorGitSpec.m b/ObjectiveGitTests/NSErrorGitSpec.m index faa611796..692174371 100644 --- a/ObjectiveGitTests/NSErrorGitSpec.m +++ b/ObjectiveGitTests/NSErrorGitSpec.m @@ -6,9 +6,9 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import -#import -#import +@import ObjectiveGit; +@import Nimble; +@import Quick; #import "QuickSpec+GTFixtures.h" diff --git a/ObjectiveGitTests/QuickSpec+GTFixtures.h b/ObjectiveGitTests/QuickSpec+GTFixtures.h index 69ff3c83b..7e5524390 100644 --- a/ObjectiveGitTests/QuickSpec+GTFixtures.h +++ b/ObjectiveGitTests/QuickSpec+GTFixtures.h @@ -6,13 +6,15 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import +@import ObjectiveGit; +@import Quick; @class GTRepository; // FIXME: This category is a total hack, but there's no other way to run // teardown logic for every example yet: // https://github.com/Quick/Quick/issues/163 +// TODO: https://github.com/Quick/Quick/blob/master/Documentation/en-us/ConfiguringQuick.md#adding-global-beforeeach-and-aftereach-closures @interface QuickSpec (GTFixtures) // The file URL for a temporary directory which will live for the length of each diff --git a/ObjectiveGitTests/QuickSpec+GTFixtures.m b/ObjectiveGitTests/QuickSpec+GTFixtures.m index 9d7302e65..279f2c36a 100644 --- a/ObjectiveGitTests/QuickSpec+GTFixtures.m +++ b/ObjectiveGitTests/QuickSpec+GTFixtures.m @@ -6,10 +6,12 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import #import "QuickSpec+GTFixtures.h" -#import -#import +//#import + +@import ObjectiveC; +@import ObjectiveGit; +@import ZipArchive; static const NSInteger FixturesErrorUnzipFailed = 666; diff --git a/ObjectiveGitTests/SwiftSpec.swift b/ObjectiveGitTests/SwiftSpec.swift index 46b8aaa00..90085614c 100644 --- a/ObjectiveGitTests/SwiftSpec.swift +++ b/ObjectiveGitTests/SwiftSpec.swift @@ -1,17 +1,18 @@ // // SwiftSpec.swift -// Archimedes +// ObjectiveGitFramework // // Created by Justin Spahr-Summers on 2014-10-02. // Copyright (c) 2014 GitHub. All rights reserved. // -import Foundation import Nimble import Quick +import XCTest // Without this, the Swift stdlib won't be linked into the test target (even if // “Embedded Content Contains Swift Code” is enabled). +// https://github.com/Quick/Quick/issues/164 class SwiftSpec: QuickSpec { override func spec() { expect(true).to(beTruthy()) From 87896b209f47df0cd2c3e3f234b003eebbf285f2 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Tue, 10 Apr 2018 00:35:37 +0200 Subject: [PATCH 178/228] Fix most nullability issues --- ObjectiveGit/GTBlob.h | 4 ++-- ObjectiveGit/GTBranch.m | 28 +++++++++++++++++++++------- ObjectiveGit/GTCheckoutOptions.h | 4 ++-- ObjectiveGit/GTConfiguration.m | 8 +++++--- ObjectiveGit/GTDiffDelta.h | 4 ++-- ObjectiveGit/GTDiffHunk.m | 4 +++- ObjectiveGit/GTEnumerator.m | 3 ++- ObjectiveGit/GTFilter.m | 4 +++- ObjectiveGit/GTIndex.m | 4 +++- ObjectiveGit/GTOID.h | 2 +- ObjectiveGit/GTOID.m | 4 +++- ObjectiveGit/GTObject.h | 6 +++--- ObjectiveGit/GTObject.m | 4 +++- ObjectiveGit/GTReference.h | 4 ++-- ObjectiveGit/GTReference.m | 5 +++-- ObjectiveGit/GTRepository.h | 2 +- ObjectiveGit/GTRepository.m | 4 +++- ObjectiveGit/GTSubmodule.h | 6 +++--- ObjectiveGit/GTSubmodule.m | 6 +++--- 19 files changed, 68 insertions(+), 38 deletions(-) diff --git a/ObjectiveGit/GTBlob.h b/ObjectiveGit/GTBlob.h index 5ab16a990..6865ee8a6 100644 --- a/ObjectiveGit/GTBlob.h +++ b/ObjectiveGit/GTBlob.h @@ -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. /// diff --git a/ObjectiveGit/GTBranch.m b/ObjectiveGit/GTBranch.m index 8e9e3d362..fe3f81f22 100644 --- a/ObjectiveGit/GTBranch.m +++ b/ObjectiveGit/GTBranch.m @@ -179,14 +179,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; } @@ -195,25 +202,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 { diff --git a/ObjectiveGit/GTCheckoutOptions.h b/ObjectiveGit/GTCheckoutOptions.h index 386838376..f8e6277d9 100644 --- a/ObjectiveGit/GTCheckoutOptions.h +++ b/ObjectiveGit/GTCheckoutOptions.h @@ -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 *pathSpecs; diff --git a/ObjectiveGit/GTConfiguration.m b/ObjectiveGit/GTConfiguration.m index 817f7a4e4..940753cf9 100644 --- a/ObjectiveGit/GTConfiguration.m +++ b/ObjectiveGit/GTConfiguration.m @@ -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]; } } diff --git a/ObjectiveGit/GTDiffDelta.h b/ObjectiveGit/GTDiffDelta.h index 88bd2bad9..35b8969b3 100644 --- a/ObjectiveGit/GTDiffDelta.h +++ b/ObjectiveGit/GTDiffDelta.h @@ -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. /// diff --git a/ObjectiveGit/GTDiffHunk.m b/ObjectiveGit/GTDiffHunk.m index f6d74bd0d..0b822903f 100644 --- a/ObjectiveGit/GTDiffHunk.m +++ b/ObjectiveGit/GTDiffHunk.m @@ -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; } diff --git a/ObjectiveGit/GTEnumerator.m b/ObjectiveGit/GTEnumerator.m index 6c76530c1..b684d4e3e 100644 --- a/ObjectiveGit/GTEnumerator.m +++ b/ObjectiveGit/GTEnumerator.m @@ -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 { diff --git a/ObjectiveGit/GTFilter.m b/ObjectiveGit/GTFilter.m index 7788c08d7..69c185ca7 100644 --- a/ObjectiveGit/GTFilter.m +++ b/ObjectiveGit/GTFilter.m @@ -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; } diff --git a/ObjectiveGit/GTIndex.m b/ObjectiveGit/GTIndex.m index 0acbf0c90..8ee64fde6 100644 --- a/ObjectiveGit/GTIndex.m +++ b/ObjectiveGit/GTIndex.m @@ -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; diff --git a/ObjectiveGit/GTOID.h b/ObjectiveGit/GTOID.h index 3291d920b..ab0590ee7 100644 --- a/ObjectiveGit/GTOID.h +++ b/ObjectiveGit/GTOID.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @interface GTOID : NSObject /// 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. diff --git a/ObjectiveGit/GTOID.m b/ObjectiveGit/GTOID.m index c9acc8fce..c97da8735 100644 --- a/ObjectiveGit/GTOID.m +++ b/ObjectiveGit/GTOID.m @@ -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 { diff --git a/ObjectiveGit/GTObject.h b/ObjectiveGit/GTObject.h index a66e02b99..66ef8b89c 100644 --- a/ObjectiveGit/GTObject.h +++ b/ObjectiveGit/GTObject.h @@ -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; diff --git a/ObjectiveGit/GTObject.m b/ObjectiveGit/GTObject.m index 43dcbe396..46ae4ae0e 100644 --- a/ObjectiveGit/GTObject.m +++ b/ObjectiveGit/GTObject.m @@ -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 { diff --git a/ObjectiveGit/GTReference.h b/ObjectiveGit/GTReference.h index f273ca00d..e2a3ffade 100644 --- a/ObjectiveGit/GTReference.h +++ b/ObjectiveGit/GTReference.h @@ -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; @@ -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. /// diff --git a/ObjectiveGit/GTReference.m b/ObjectiveGit/GTReference.m index d34d946a2..bdb0fb13a 100644 --- a/ObjectiveGit/GTReference.m +++ b/ObjectiveGit/GTReference.m @@ -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); } @@ -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 { diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index 270457f16..b57430b50 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -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. /// diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index e0b0a8582..cd4fce6b8 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -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]; } }]; } diff --git a/ObjectiveGit/GTSubmodule.h b/ObjectiveGit/GTSubmodule.h index eabc37698..1e55fe16f 100644 --- a/ObjectiveGit/GTSubmodule.h +++ b/ObjectiveGit/GTSubmodule.h @@ -79,14 +79,14 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, strong, readonly) GTOID * _Nullable workingDirectoryOID; /// The name of this submodule. -@property (nonatomic, copy, readonly) NSString * _Nullable name; +@property (nonatomic, copy, readonly) NSString *name; /// The path to this submodule, relative to its parent repository's root. -@property (nonatomic, copy, readonly) NSString * _Nullable path; +@property (nonatomic, copy, readonly) NSString *path; /// The remote URL provided for this submodule, read from the parent repository's /// `.git/config` or `.gitmodules` file. -@property (nonatomic, copy, readonly) NSString * _Nullable URLString; +@property (nonatomic, copy, readonly) NSString *URLString; - (instancetype)init NS_UNAVAILABLE; diff --git a/ObjectiveGit/GTSubmodule.m b/ObjectiveGit/GTSubmodule.m index 8d70ea3e1..968920d83 100644 --- a/ObjectiveGit/GTSubmodule.m +++ b/ObjectiveGit/GTSubmodule.m @@ -60,21 +60,21 @@ - (GTOID *)workingDirectoryOID { - (NSString *)name { const char *cName = git_submodule_name(self.git_submodule); - if (cName == NULL) return nil; + NSAssert(cName != NULL, @"Unexpected nil submodule name"); return @(cName); } - (NSString *)path { const char *cPath = git_submodule_path(self.git_submodule); - if (cPath == NULL) return nil; + NSAssert(cPath != NULL, @"Unexpected nil submodule path"); return @(cPath); } - (NSString *)URLString { const char *cURL = git_submodule_url(self.git_submodule); - if (cURL == NULL) return nil; + NSAssert(cURL != NULL, @"Unexpected nil submodule URL"); return @(cURL); } From 6005a6cf0c89ee4517aa75f614184c46bc2f5298 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Mon, 9 Apr 2018 20:11:15 -0600 Subject: [PATCH 179/228] =?UTF-8?q?=F0=9F=9A=A8=20Extract=20local=20vars?= =?UTF-8?q?=20to=20work=20around=20OID=20nullability=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ObjectiveGit/GTBranch.m | 18 +++++++++++++----- ObjectiveGit/GTReference.h | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ObjectiveGit/GTBranch.m b/ObjectiveGit/GTBranch.m index fe3f81f22..ec54cbd5d 100644 --- a/ObjectiveGit/GTBranch.m +++ b/ObjectiveGit/GTBranch.m @@ -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]; } @@ -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]; } @@ -253,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 diff --git a/ObjectiveGit/GTReference.h b/ObjectiveGit/GTReference.h index e2a3ffade..786739fac 100644 --- a/ObjectiveGit/GTReference.h +++ b/ObjectiveGit/GTReference.h @@ -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. From a5f37486e9bce9d6e1aa3e763e788c70bbb6ba52 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Mon, 9 Apr 2018 20:12:29 -0600 Subject: [PATCH 180/228] =?UTF-8?q?=F0=9F=8E=A8=20Clean=20up=20dead=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ObjectiveGitTests/QuickSpec+GTFixtures.m | 1 - 1 file changed, 1 deletion(-) diff --git a/ObjectiveGitTests/QuickSpec+GTFixtures.m b/ObjectiveGitTests/QuickSpec+GTFixtures.m index 279f2c36a..a54270a39 100644 --- a/ObjectiveGitTests/QuickSpec+GTFixtures.m +++ b/ObjectiveGitTests/QuickSpec+GTFixtures.m @@ -7,7 +7,6 @@ // #import "QuickSpec+GTFixtures.h" -//#import @import ObjectiveC; @import ObjectiveGit; From 43dc9ba0ea8176ca5dcb71340ba13e5d00f43a01 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Mon, 9 Apr 2018 20:24:47 -0600 Subject: [PATCH 181/228] =?UTF-8?q?=F0=9F=94=A7=20Disable=20nullability=20?= =?UTF-8?q?warnings=20in=20test=20targets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index d0f88e2c5..779476c9d 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -1853,6 +1853,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = F81B6B54207B0A9F00AB0836 /* Mac-XCTest.xcconfig */; buildSettings = { + CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", @@ -1878,6 +1879,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = D0D81867174421EB00995A2E /* Mac-Application.xcconfig */; buildSettings = { + CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", @@ -1960,6 +1962,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = F81B6B54207B0A9F00AB0836 /* Mac-XCTest.xcconfig */; buildSettings = { + CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", @@ -2202,6 +2205,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = D0D81867174421EB00995A2E /* Mac-Application.xcconfig */; buildSettings = { + CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", @@ -2278,6 +2282,7 @@ CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = NO; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -2330,6 +2335,7 @@ CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = NO; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -2375,6 +2381,7 @@ CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = NO; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -2421,6 +2428,7 @@ CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = NO; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; From 7895ba98336601785b8bed97779d41bbdf4bc243 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Mon, 9 Apr 2018 20:56:25 -0600 Subject: [PATCH 182/228] =?UTF-8?q?=F0=9F=91=B7=F0=9F=8F=BB=E2=80=8D?= =?UTF-8?q?=E2=99=80=EF=B8=8F=E2=AC=86=EF=B8=8F=20Update=20travis=20image?= =?UTF-8?q?=20to=20xcode9.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index d9562096f..4cab7cf69 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,17 +7,16 @@ # --- os: osx -# 9.3 beta is latest available as of 2018-04-08 -osx_image: xcode9.3beta +osx_image: xcode9.3 language: objective-c matrix: fast_finish: true include: - - osx_image: xcode9.3beta + - osx_image: xcode9.3 env: - SCHEME="ObjectiveGit Mac" - - osx_image: xcode9.3beta + - osx_image: xcode9.3 env: - SCHEME="ObjectiveGit iOS" From 2710a03973e5a823f93368bef0941305bdf21988 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 9 Apr 2018 20:46:04 +0000 Subject: [PATCH 183/228] Update openssl to 1.0.2o --- External/openssl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/openssl b/External/openssl index 872e681c0..3ce7bc40a 160000 --- a/External/openssl +++ b/External/openssl @@ -1 +1 @@ -Subproject commit 872e681c00a713e840ebed77a4e05fa0e181f16f +Subproject commit 3ce7bc40a3c48da1c96c2d04c10045bd797c6aa3 From 62ad292b8a662fe068d5dea31d2547eae9694a1d Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Tue, 10 Apr 2018 19:29:47 -0600 Subject: [PATCH 184/228] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Nimble=20(7.1.0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cartfile.private | 2 +- Cartfile.resolved | 2 +- Carthage/Checkouts/Nimble | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cartfile.private b/Cartfile.private index a1c51bdf2..476c2a1f6 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,4 +1,4 @@ github "jspahrsummers/xcconfigs" "master" github "Quick/Quick" ~> 1.2.0 -github "Quick/Nimble" ~> 7.0.3 +github "Quick/Nimble" ~> 7.1.0 github "ZipArchive/ZipArchive" ~> 2.1.2 diff --git a/Cartfile.resolved b/Cartfile.resolved index 22fec494b..ef51bc1cb 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ -github "Quick/Nimble" "v7.0.3" +github "Quick/Nimble" "v7.1.0" github "Quick/Quick" "v1.2.0" github "ZipArchive/ZipArchive" "v2.1.2" github "jspahrsummers/xcconfigs" "bb795558a76e5daf3688500055bbcfe243bffa8d" diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble index 22800b095..5e11474ae 160000 --- a/Carthage/Checkouts/Nimble +++ b/Carthage/Checkouts/Nimble @@ -1 +1 @@ -Subproject commit 22800b0954c89344bb8c87f8ab93378076716fb7 +Subproject commit 5e11474ae6ea796a07e722fea49269d26710744d From 75b94fac7777782a45832cd30dd8a65f70009f0f Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Wed, 2 May 2018 22:00:35 -0600 Subject: [PATCH 185/228] =?UTF-8?q?=F0=9F=90=9B=20Remove=20Nimble=20depend?= =?UTF-8?q?ency=20from=20iOS=20target?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 779476c9d..3ca2f0336 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -319,7 +319,6 @@ F81B6B50207B032800AB0836 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63871207AE62A00D1FD32 /* XCTest.framework */; }; F81B6B55207B0A9F00AB0836 /* Mac-XCTest.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = F81B6B54207B0A9F00AB0836 /* Mac-XCTest.xcconfig */; }; F81B6B59207B0D3B00AB0836 /* SwiftSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0A0129619F9A660007F1914 /* SwiftSpec.swift */; }; - F84277BA207B1002008AB8E8 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63865207ACCAA00D1FD32 /* Nimble.framework */; }; F84277BE207B104A008AB8E8 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63872207AE63A00D1FD32 /* XCTest.framework */; }; F86949AA1BF1B79E00A989D3 /* GTUtilityFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0391B4059ED000FF7D0 /* GTUtilityFunctions.m */; }; F879D8311B4B788F002D5C07 /* Libgit2FeaturesSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F879D82F1B4B77F4002D5C07 /* Libgit2FeaturesSpec.m */; }; @@ -694,7 +693,6 @@ F8D63861207ACAF700D1FD32 /* libiconv.tbd in Frameworks */, F8D6385F207ACAE600D1FD32 /* libz.tbd in Frameworks */, D05FC5E319FAD03C008C9348 /* libssl.a in Frameworks */, - F84277BA207B1002008AB8E8 /* Nimble.framework in Frameworks */, D05FC5E219FAD039008C9348 /* libcrypto.a in Frameworks */, D05FC5E419FAD040008C9348 /* libssh2-ios.a in Frameworks */, ); From 691abee467ca76ad3f4768a51ff2147e4342f909 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 23 Apr 2018 23:01:15 +0200 Subject: [PATCH 186/228] Relax SWIFT_VERSION so the tests (and me) can run --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 3ca2f0336..80daaf01a 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -1752,7 +1752,7 @@ "$(inherited)", "-DGIT_SSH", ); - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( "$(inherited)", @@ -1790,7 +1790,7 @@ "$(inherited)", "-DGIT_SSH", ); - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( "$(inherited)", @@ -1923,7 +1923,7 @@ "$(inherited)", "-DGIT_SSH", ); - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( "$(inherited)", @@ -2166,7 +2166,7 @@ "$(inherited)", "-DGIT_SSH", ); - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( "$(inherited)", @@ -2317,7 +2317,6 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; - SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -2362,7 +2361,6 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; - SWIFT_VERSION = 4.0; VALIDATE_PRODUCT = YES; }; name = Test; @@ -2409,7 +2407,6 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -2455,7 +2452,6 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; - SWIFT_VERSION = 4.0; VALIDATE_PRODUCT = YES; }; name = Profile; From 2f45f70cdcfb3439526a7ceecc309e2808b393c6 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 23 Apr 2018 23:01:17 +0200 Subject: [PATCH 187/228] Add missing headers to the modulemap --- ObjectiveGit.modulemap | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ObjectiveGit.modulemap b/ObjectiveGit.modulemap index e52bf7ccb..bb441d417 100644 --- a/ObjectiveGit.modulemap +++ b/ObjectiveGit.modulemap @@ -57,12 +57,14 @@ framework module ObjectiveGit { header "git2/sys/hashsig.h" header "git2/sys/index.h" header "git2/sys/mempack.h" + header "git2/sys/merge.h" header "git2/sys/odb_backend.h" header "git2/sys/refdb_backend.h" header "git2/sys/reflog.h" header "git2/sys/refs.h" header "git2/sys/repository.h" header "git2/sys/transport.h" + header "git2/sys/time.h" header "git2/cred_helpers.h" header "git2/sys/openssl.h" header "git2/sys/stream.h" From 91e11e364b0bc14c8a9d1f6eba0477086e002b06 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 23 Apr 2018 23:01:19 +0200 Subject: [PATCH 188/228] Update libgit2 to 0.27 final --- External/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libgit2 b/External/libgit2 index b8cb75361..6311e886d 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit b8cb75361d48f16f41dfa99b5b988a914e53040b +Subproject commit 6311e886d8b5377c6037cd9937ccf66a71f3361d From c978f214c1b2c3d29f462003d8c554895f63acea Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 23 Apr 2018 23:01:20 +0200 Subject: [PATCH 189/228] Test the ssh support availability --- ObjectiveGitTests/Libgit2FeaturesSpec.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ObjectiveGitTests/Libgit2FeaturesSpec.m b/ObjectiveGitTests/Libgit2FeaturesSpec.m index d1898975d..1a57524f5 100644 --- a/ObjectiveGitTests/Libgit2FeaturesSpec.m +++ b/ObjectiveGitTests/Libgit2FeaturesSpec.m @@ -30,10 +30,17 @@ expect(@(git_features & GIT_FEATURE_HTTPS)).to(beTruthy()); }); - xit(@"should be built with SSH enabled", ^{ + it(@"should be built with SSH enabled", ^{ expect(@(git_features & GIT_FEATURE_SSH)).to(beTruthy()); }); + it(@"should have ssh memory credentials", ^{ + NSError *error; + GTCredential *cred = [GTCredential credentialWithUserName:@"null" publicKeyString:@"pub" privateKeyString:@"priv" passphrase:@"pass" error:&error]; + + expect(cred).notTo(beNil()); + expect(error).to(beNil()); + }); }); QuickSpecEnd From a3a3c1357d8e6ae3124adb848aea4fc52d996b60 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 23 Apr 2018 23:01:22 +0200 Subject: [PATCH 190/228] Build system overhaul! This changes our various scripts to dump their build artifacts in External/build instead of various per-external directories (or /tmp for OpenSSL), which makes it easier to link them to each other when we finally get to building libgit2 on iOS. --- External/libcrypto.a | 1 - External/libssl.a | 1 - .../project.pbxproj | 100 +++++++++--------- script/ios_build_functions.sh | 24 ++++- script/update_libgit2_ios | 45 ++++---- script/update_libssh2_ios | 32 +++--- script/update_libssl_ios | 51 ++++----- script/xcode_functions.sh | 2 +- 8 files changed, 123 insertions(+), 133 deletions(-) delete mode 120000 External/libcrypto.a delete mode 120000 External/libssl.a diff --git a/External/libcrypto.a b/External/libcrypto.a deleted file mode 120000 index fe603c877..000000000 --- a/External/libcrypto.a +++ /dev/null @@ -1 +0,0 @@ -/usr/local/opt/openssl/lib/libcrypto.a \ No newline at end of file diff --git a/External/libssl.a b/External/libssl.a deleted file mode 120000 index e321f3268..000000000 --- a/External/libssl.a +++ /dev/null @@ -1 +0,0 @@ -/usr/local/opt/openssl/lib/libssl.a \ No newline at end of file diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 80daaf01a..223374f95 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -91,11 +91,14 @@ 4D1C40D8182C006D00BE2960 /* GTBlobSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D1C40D7182C006D00BE2960 /* GTBlobSpec.m */; }; 4D79C0EE17DF9F4D00997DE4 /* GTCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D79C0EC17DF9F4D00997DE4 /* GTCredential.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4D79C0EF17DF9F4D00997DE4 /* GTCredential.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D79C0ED17DF9F4D00997DE4 /* GTCredential.m */; }; + 4D9BCD24206D84AD003CD3CE /* libgit2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D9BCD23206D84AD003CD3CE /* libgit2.a */; }; + 4D9BCD25206D84B2003CD3CE /* libgit2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D9BCD23206D84AD003CD3CE /* libgit2.a */; }; 4DBA4A3217DA73CE006CD5F5 /* GTRemoteSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DBA4A3117DA73CE006CD5F5 /* GTRemoteSpec.m */; }; 4DC55AE51AD859AD0032563C /* GTCheckoutOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4DC55AE61AD859AD0032563C /* GTCheckoutOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4DC55AE71AD859AD0032563C /* GTCheckoutOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */; }; 4DC55AE81AD859AD0032563C /* GTCheckoutOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */; }; + 4DFA918F207D0B87003CD3CE /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63865207ACCAA00D1FD32 /* Nimble.framework */; }; 4DFFB15B183AA8D600D1565E /* GTRepository+RemoteOperations.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DFFB159183AA8D600D1565E /* GTRepository+RemoteOperations.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4DFFB15C183AA8D600D1565E /* GTRepository+RemoteOperations.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DFFB15A183AA8D600D1565E /* GTRepository+RemoteOperations.m */; }; 55C8055013861FE7004DCB0F /* GTObjectDatabase.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C8054D13861F34004DCB0F /* GTObjectDatabase.m */; }; @@ -297,7 +300,7 @@ D040AF78177B9A9E001AD9EB /* GTSignatureSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D040AF77177B9A9E001AD9EB /* GTSignatureSpec.m */; }; D05FC5E219FAD039008C9348 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A1F2FD317C6A8F3003DFADE /* libcrypto.a */; }; D05FC5E319FAD03C008C9348 /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A1F2FD417C6A8F3003DFADE /* libssl.a */; }; - D05FC5E419FAD040008C9348 /* libssh2-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A502B8617D6892D00BAF4A5 /* libssh2-ios.a */; }; + D05FC5E419FAD040008C9348 /* libssh2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A502B8617D6892D00BAF4A5 /* libssh2.a */; }; D06D9E011755D10000558C17 /* GTEnumeratorSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D06D9E001755D10000558C17 /* GTEnumeratorSpec.m */; }; D0751CD918BE520400134314 /* GTFilterListSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D0751CD818BE520400134314 /* GTFilterListSpec.m */; }; D09C2E361755F16200065E36 /* GTSubmodule.h in Headers */ = {isa = PBXBuildFile; fileRef = D09C2E341755F16200065E36 /* GTSubmodule.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -490,6 +493,7 @@ 4D79C0EC17DF9F4D00997DE4 /* GTCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTCredential.h; sourceTree = ""; }; 4D79C0ED17DF9F4D00997DE4 /* GTCredential.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTCredential.m; sourceTree = ""; }; 4D79C0F617DFAA7100997DE4 /* GTCredential+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTCredential+Private.h"; sourceTree = ""; }; + 4D9BCD23206D84AD003CD3CE /* libgit2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgit2.a; path = External/build/lib/libgit2.a; sourceTree = ""; }; 4DBA4A3117DA73CE006CD5F5 /* GTRemoteSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTRemoteSpec.m; sourceTree = ""; }; 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTCheckoutOptions.h; sourceTree = ""; }; 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTCheckoutOptions.m; sourceTree = ""; }; @@ -503,9 +507,9 @@ 5BE612861745EE3300266D8C /* GTTreeBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTTreeBuilder.h; sourceTree = ""; }; 5BE612871745EE3300266D8C /* GTTreeBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTTreeBuilder.m; sourceTree = ""; }; 5BE612921745EEBC00266D8C /* GTTreeBuilderSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTTreeBuilderSpec.m; sourceTree = ""; }; - 6A1F2FD317C6A8F3003DFADE /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = "External/ios-openssl/lib/libcrypto.a"; sourceTree = ""; }; - 6A1F2FD417C6A8F3003DFADE /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = "External/ios-openssl/lib/libssl.a"; sourceTree = ""; }; - 6A502B8617D6892D00BAF4A5 /* libssh2-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libssh2-ios.a"; path = "External/libssh2-ios/lib/libssh2-ios.a"; sourceTree = ""; }; + 6A1F2FD317C6A8F3003DFADE /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = External/build/lib/libcrypto.a; sourceTree = ""; }; + 6A1F2FD417C6A8F3003DFADE /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = External/build/lib/libssl.a; sourceTree = ""; }; + 6A502B8617D6892D00BAF4A5 /* libssh2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssh2.a; path = External/build/lib/libssh2.a; sourceTree = ""; }; 6EEB519F199D62B9001D72C0 /* GTFetchHeadEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTFetchHeadEntry.h; sourceTree = ""; }; 6EEB51A0199D62B9001D72C0 /* GTFetchHeadEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTFetchHeadEntry.m; sourceTree = ""; }; 79262F0E13C697BE00A4B1EA /* git2 */ = {isa = PBXFileReference; lastKnownFileType = folder; name = git2; path = External/libgit2/include/git2; sourceTree = ""; }; @@ -682,6 +686,7 @@ files = ( F8D6385D207AC75100D1FD32 /* libz.tbd in Frameworks */, F8D6385C207AC74A00D1FD32 /* libiconv.tbd in Frameworks */, + 4D9BCD24206D84AD003CD3CE /* libgit2.a in Frameworks */, 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -694,7 +699,8 @@ F8D6385F207ACAE600D1FD32 /* libz.tbd in Frameworks */, D05FC5E319FAD03C008C9348 /* libssl.a in Frameworks */, D05FC5E219FAD039008C9348 /* libcrypto.a in Frameworks */, - D05FC5E419FAD040008C9348 /* libssh2-ios.a in Frameworks */, + D05FC5E419FAD040008C9348 /* libssh2.a in Frameworks */, + 4D9BCD25206D84B2003CD3CE /* libgit2.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -705,6 +711,7 @@ F84277BE207B104A008AB8E8 /* XCTest.framework in Frameworks */, F8D63868207ACCEE00D1FD32 /* Quick.framework in Frameworks */, F879D83C1B4B7F7D002D5C07 /* ObjectiveGit.framework in Frameworks */, + 4DFA918F207D0B87003CD3CE /* Nimble.framework in Frameworks */, F8D6386A207ACDDD00D1FD32 /* ZipArchive.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -744,16 +751,17 @@ 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { isa = PBXGroup; children = ( - 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, 306123A817EA5261006591D4 /* extobjc */, 889923F919FF5DD40092A9A6 /* git2 */, 6A1F2FD317C6A8F3003DFADE /* libcrypto.a */, F8D63860207ACAF600D1FD32 /* libiconv.tbd */, F8D6385B207AC74A00D1FD32 /* libiconv.tbd */, - 6A502B8617D6892D00BAF4A5 /* libssh2-ios.a */, - 6A1F2FD417C6A8F3003DFADE /* libssl.a */, 23BB67BB1C7DF45300A37A66 /* libz.tbd */, F8D6385E207ACAE600D1FD32 /* libz.tbd */, + 6A1F2FD417C6A8F3003DFADE /* libssl.a */, + 6A502B8617D6892D00BAF4A5 /* libssh2.a */, + 4D9BCD23206D84AD003CD3CE /* libgit2.a */, + 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, D0A0128B19F9853D007F1914 /* Nimble.framework */, F8D63865207ACCAA00D1FD32 /* Nimble.framework */, D0A0128819F98475007F1914 /* Quick.framework */, @@ -1681,6 +1689,10 @@ DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; INFOPLIST_FILE = Info.plist; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/External/build/lib", + ); MODULEMAP_FILE = ObjectiveGit.modulemap; OTHER_LDFLAGS = ( "-lgit2", @@ -1705,6 +1717,10 @@ DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; INFOPLIST_FILE = Info.plist; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/External/build/lib", + ); MODULEMAP_FILE = ObjectiveGit.modulemap; OTHER_LDFLAGS = ( "-lgit2", @@ -1940,6 +1956,10 @@ DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; INFOPLIST_FILE = Info.plist; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/External/build/lib", + ); MODULEMAP_FILE = ObjectiveGit.modulemap; OTHER_LDFLAGS = ( "-lgit2", @@ -1988,22 +2008,15 @@ DYLIB_CURRENT_VERSION = 1; HEADER_SEARCH_PATHS = ( "$(inherited)", - "External/libssh2-ios/include/libssh2", - External/libgit2/include, + External/build/include, ); INFOPLIST_FILE = Info.plist; - LIBRARY_SEARCH_PATHS = ( - "External/ios-openssl/lib", - "External/libssh2-ios/lib", - "External/libgit2-ios", - ); + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/External/build/lib"; MODULEMAP_FILE = ObjectiveGit.modulemap; - OTHER_LDFLAGS = ( - "-lgit2-ios", - "-all_load", - ); + OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = ObjectiveGit; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/External/libgit2/include"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2052,22 +2065,15 @@ DYLIB_CURRENT_VERSION = 1; HEADER_SEARCH_PATHS = ( "$(inherited)", - "External/libssh2-ios/include/libssh2", - External/libgit2/include, + External/build/include, ); INFOPLIST_FILE = Info.plist; - LIBRARY_SEARCH_PATHS = ( - "External/ios-openssl/lib", - "External/libssh2-ios/lib", - "External/libgit2-ios", - ); + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/External/build/lib"; MODULEMAP_FILE = ObjectiveGit.modulemap; - OTHER_LDFLAGS = ( - "-lgit2-ios", - "-all_load", - ); + OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = ObjectiveGit; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/External/libgit2/include"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2084,22 +2090,15 @@ DYLIB_CURRENT_VERSION = 1; HEADER_SEARCH_PATHS = ( "$(inherited)", - "External/libssh2-ios/include/libssh2", - External/libgit2/include, + External/build/include, ); INFOPLIST_FILE = Info.plist; - LIBRARY_SEARCH_PATHS = ( - "External/ios-openssl/lib", - "External/libssh2-ios/lib", - "External/libgit2-ios", - ); + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/External/build/lib"; MODULEMAP_FILE = ObjectiveGit.modulemap; - OTHER_LDFLAGS = ( - "-lgit2-ios", - "-all_load", - ); + OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = ObjectiveGit; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/External/libgit2/include"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2116,22 +2115,15 @@ DYLIB_CURRENT_VERSION = 1; HEADER_SEARCH_PATHS = ( "$(inherited)", - "External/libssh2-ios/include/libssh2", - External/libgit2/include, + External/build/include, ); INFOPLIST_FILE = Info.plist; - LIBRARY_SEARCH_PATHS = ( - "External/ios-openssl/lib", - "External/libssh2-ios/lib", - "External/libgit2-ios", - ); + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/External/build/lib"; MODULEMAP_FILE = ObjectiveGit.modulemap; - OTHER_LDFLAGS = ( - "-lgit2-ios", - "-all_load", - ); + OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = ObjectiveGit; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/External/libgit2/include"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2183,6 +2175,10 @@ DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; INFOPLIST_FILE = Info.plist; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/External/build/lib", + ); MODULEMAP_FILE = ObjectiveGit.modulemap; OTHER_LDFLAGS = ( "-lgit2", diff --git a/script/ios_build_functions.sh b/script/ios_build_functions.sh index 36f5b14c7..fc7cd8be7 100755 --- a/script/ios_build_functions.sh +++ b/script/ios_build_functions.sh @@ -9,7 +9,7 @@ function setup_build_environment () # e.g. via brew. Xcode's Run Script phase doesn't seem to honor # ~/.MacOSX/environment.plist PATH="/usr/local/bin:/opt/boxen/homebrew/bin:$PATH" - + pushd "$SCRIPT_DIR/.." > /dev/null ROOT_PATH="$PWD" popd > /dev/null @@ -22,7 +22,7 @@ function setup_build_environment () MACOSX_DEPLOYMENT_TARGET="" XCODE_MAJOR_VERSION=$(xcode_major_version) - + CAN_BUILD_64BIT="0" # If IPHONEOS_DEPLOYMENT_TARGET has not been specified @@ -32,7 +32,7 @@ function setup_build_environment () then IPHONEOS_DEPLOYMENT_TARGET="6.0" fi - + # Determine if we can be building 64-bit binaries if [ "${XCODE_MAJOR_VERSION}" -ge "5" ] && [ $(echo ${IPHONEOS_DEPLOYMENT_TARGET} '>=' 6.0 | bc -l) == "1" ] then @@ -46,12 +46,19 @@ function setup_build_environment () # builds to be first ARCHS="x86_64 ${ARCHS} arm64" fi + + # Setup a shared area for our build artifacts + INSTALL_PATH="${ROOT_PATH}/External/build" + mkdir -p "${INSTALL_PATH}" + mkdir -p "${INSTALL_PATH}/log" + mkdir -p "${INSTALL_PATH}/include" + mkdir -p "${INSTALL_PATH}/lib/pkgconfig" } function build_all_archs () { setup_build_environment - + local setup=$1 local build_arch=$2 local finish_build=$3 @@ -81,10 +88,17 @@ function build_all_archs () SDKNAME="${PLATFORM}${SDKVERSION}" SDKROOT="$(ios_sdk_path ${SDKNAME})" - + + LOG="${INSTALL_PATH}/log/${LIBRARY_NAME}-${ARCH}.log" + [ -f "${LOG}" ] && rm "${LOG}" + echo "Building ${LIBRARY_NAME} for ${SDKNAME} ${ARCH}" + echo "Build log can be found in ${LOG}" echo "Please stand by..." + ARCH_INSTALL_PATH="${INSTALL_PATH}/${SDKNAME}-${ARCH}.sdk" + mkdir -p "${ARCH_INSTALL_PATH}" + # run the per arch build command eval $build_arch done diff --git a/script/update_libgit2_ios b/script/update_libgit2_ios index 7732f32e9..7e6d46ef0 100755 --- a/script/update_libgit2_ios +++ b/script/update_libgit2_ios @@ -8,69 +8,60 @@ source "${SCRIPT_DIR}/ios_build_functions.sh" function setup () { - if [ "${ROOT_PATH}/External/libgit2-ios/libgit2-ios.a" -nt "${ROOT_PATH}/External/libgit2" ] + if [ "${INSTALL_PATH}/lib/libgit2.a" -nt "${ROOT_PATH}/External/libgit2" ] then echo "No update needed." exit 0 fi LIBRARY_NAME="libgit2" - LIB_PATH="${ROOT_PATH}/External/libgit2-ios" - rm -rf "${LIB_PATH}" - - pushd "${ROOT_PATH}/External/libgit2" > /dev/null } function build_libgit2 () { - rm -rf "build" - mkdir "build" - - pushd "build" > /dev/null - # LOL Cmake - if [ "${ARCH}" != "i386" ] && [ "${ARCH}" != "x86_64" ] - then - SYS_ROOT="-DCMAKE_OSX_SYSROOT=${SDKROOT}" - fi + # Force CMake to rebuild + rm -rf "${ARCH_INSTALL_PATH}/libgit2" - # install the each built arch somewhere sane - INSTALL_PREFIX="${LIB_PATH}/${SDKNAME}-${ARCH}.sdk" + mkdir -p "${ARCH_INSTALL_PATH}/libgit2" + pushd "${ARCH_INSTALL_PATH}/libgit2" > /dev/null - mkdir -p "${INSTALL_PREFIX}" + # LOL Cmake + SYS_ROOT="-DCMAKE_OSX_SYSROOT=${SDKROOT}" - LOG="${INSTALL_PREFIX}/build-libgit2.log" - echo "$LOG" + # Limit pkg-config to what we're currently expecting it to use + # PKG_CONFIG_PATH="${INSTALL_PATH}/lib/pkgconfig/" + # LDFLAGS="-L $(xcrun --sdk iphoneos --show-sdk-path)/usr/lib" + # export PKG_CONFIG_PATH + # export LDFLAGS cmake \ -DCMAKE_C_COMPILER_WORKS:BOOL=ON \ -DBUILD_SHARED_LIBS:BOOL=OFF \ - -DCMAKE_PREFIX_PATH:PATH="${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk" \ + -DCMAKE_PREFIX_PATH:PATH="${INSTALL_PATH}/" \ -DPKG_CONFIG_USE_CMAKE_PREFIX_PATH:BOOL=ON \ - -DCMAKE_INSTALL_PREFIX:PATH="${INSTALL_PREFIX}/" \ + -DCMAKE_INSTALL_PREFIX:PATH="${ARCH_INSTALL_PATH}/" \ -DBUILD_CLAR:BOOL=OFF \ -DTHREADSAFE:BOOL=ON \ -DCURL:BOOL=OFF \ -DCMAKE_C_FLAGS:STRING="-fembed-bitcode" \ "${SYS_ROOT}" \ -DCMAKE_OSX_ARCHITECTURES:STRING="${ARCH}" \ - .. >> "${LOG}" 2>&1 + "${ROOT_PATH}/External/libgit2" >> "${LOG}" 2>&1 cmake --build . --target install >> "${LOG}" 2>&1 + popd > /dev/null # push the built library into the list - BUILT_LIB_PATHS+=("${INSTALL_PREFIX}/lib/libgit2.a") - popd > /dev/null + BUILT_LIB_PATHS+=("${ARCH_INSTALL_PATH}/lib/libgit2.a") } function fat_binary () { echo "Building fat binary..." - lipo -create "${BUILT_LIB_PATHS[@]}" -output "${ROOT_PATH}/External/libgit2-ios/libgit2-ios.a" + lipo -create "${BUILT_LIB_PATHS[@]}" -output "${INSTALL_PATH}/lib/libgit2.a" echo "Building done." - - popd > /dev/null } build_all_archs setup build_libgit2 fat_binary diff --git a/script/update_libssh2_ios b/script/update_libssh2_ios index 8dd89c51c..58283ee35 100755 --- a/script/update_libssh2_ios +++ b/script/update_libssh2_ios @@ -8,7 +8,7 @@ source "${SCRIPT_DIR}/ios_build_functions.sh" function setup () { - if [ -f "${ROOT_PATH}/External/libssh2-ios/lib/libssh2-ios.a" ] + if [ -f "${INSTALL_PATH}/lib/libssh2.a" ] then echo "No update needed." exit 0 @@ -16,38 +16,36 @@ function setup () LIBRARY_NAME="libssh2" } -function build_ssh2 () +function build_ssh2 () { - mkdir -p "${ROOT_PATH}/External/libssh2-ios/lib" "${ROOT_PATH}/External/libssh2-ios/lib" "${ROOT_PATH}/External/libssh2-ios/src" - - rm -rf "${ROOT_PATH}/External/libssh2-ios/src/libssh2" - cp -R "${ROOT_PATH}/External/libssh2" "${ROOT_PATH}/External/libssh2-ios/src/" - pushd "${ROOT_PATH}/External/libssh2-ios/src/libssh2" > /dev/null + cp -R "${ROOT_PATH}/External/libssh2" "${ARCH_INSTALL_PATH}/libssh2" + pushd "${ARCH_INSTALL_PATH}/libssh2" > /dev/null export CFLAGS="-arch ${ARCH} -fembed-bitcode -pipe -no-cpp-precomp -isysroot ${SDKROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}" export CPPFLAGS="-arch ${ARCH} -fembed-bitcode -pipe -no-cpp-precomp -isysroot ${SDKROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}" - mkdir -p "${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk" - LOG="${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk/build-libssh2.log" - - echo "${LOG}" - ./buildconf >> "${LOG}" 2>&1 - ./configure --host=${HOST} --prefix="${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk" --with-openssl --with-libssl-prefix="${ROOT_PATH}/External/ios-openssl" --disable-shared --enable-static >> "${LOG}" 2>&1 + ./configure --host=${HOST} --prefix="${ARCH_INSTALL_PATH}" --with-openssl --with-libssl-prefix="${INSTALL_PATH}" --disable-shared --enable-static >> "${LOG}" 2>&1 make >> "${LOG}" 2>&1 make install >> "${LOG}" 2>&1 popd > /dev/null - BUILT_LIBS+=("${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk/lib/libssh2.a") + rm -rf "${ARCH_INSTALL_PATH}/libssh2" + + BUILT_LIBS+=("${ARCH_INSTALL_PATH}/lib/libssh2.a") } function fat_binary () { + echo "Copying headers & pkg-config files" + + cp -r "${ARCH_INSTALL_PATH}"/include/libssh*.h "${INSTALL_PATH}/include/" + cp "${ARCH_INSTALL_PATH}/lib/pkgconfig/libssh2.pc" "${INSTALL_PATH}/lib/pkgconfig/" + perl -i -pe "s|^(prefix=${INSTALL_PATH}).*$|\$1|g" "${INSTALL_PATH}/lib/pkgconfig/libssh2.pc" >> "${LOG}" 2>&1 + echo "Building fat binary..." - lipo -create "${BUILT_LIBS[@]}" -output "${ROOT_PATH}/External/libssh2-ios/lib/libssh2-ios.a" - mkdir -p "${ROOT_PATH}/External/libssh2-ios/include/libssh2" - cp -R "${ROOT_PATH}/External/libssh2-ios/bin/iphonesimulator${SDKVERSION}-i386.sdk/include/libssh2.h" "${ROOT_PATH}/External/libssh2-ios/include/libssh2/" + lipo -create "${BUILT_LIBS[@]}" -output "${INSTALL_PATH}/lib/libssh2.a" echo "Building done." } diff --git a/script/update_libssl_ios b/script/update_libssl_ios index 54c0a9a1e..2b4593683 100755 --- a/script/update_libssl_ios +++ b/script/update_libssl_ios @@ -1,35 +1,28 @@ #!/bin/bash +set -e + # source the common build functions SCRIPT_DIR=$(dirname "$0") source "${SCRIPT_DIR}/ios_build_functions.sh" function setup () { - if [ -f "${ROOT_PATH}/External/ios-openssl/lib/libssl.a" ] && [ -f "${ROOT_PATH}/External/ios-openssl/lib/libcrypto.a" ] && [ -d "${ROOT_PATH}/External/ios-openssl/include" ] + if [ -f "${INSTALL_PATH}/lib/libssl.a" -a \ + -f "${INSTALL_PATH}/lib/libcrypto.a" -a \ + -d "${INSTALL_PATH}/include/openssl" ] then echo "No update needed." exit 0 fi LIBRARY_NAME="OpenSSL" - - rm -rf "${ROOT_PATH}/External/ios-openssl/include" "External/ios-openssl/lib" -} - -function cleanup () -{ - rm -rf "/tmp/openssl" - rm -rf "/tmp/openssl-*.log" } -function build_ssl () +function build_ssl () { - rm -rf "/tmp/openssl" - cp -r "${ROOT_PATH}/External/openssl" "/tmp/" - pushd "/tmp/openssl" > /dev/null - - LOG="/tmp/openssl-${ARCH}.log" + cp -r "${ROOT_PATH}/External/openssl" "${ARCH_INSTALL_PATH}/openssl" + pushd "${ARCH_INSTALL_PATH}/openssl" > /dev/null if [ "${ARCH}" == "arm64" ] || [ "${ARCH}" == "x86_64" ] then @@ -40,36 +33,36 @@ function build_ssl () CONFIG="no-gost no-asm" perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c fi - echo "$LOG" - ./Configure ${HOST} ${CONFIG} --openssldir="/tmp/openssl-${ARCH}" >> "${LOG}" 2>&1 + ./Configure ${HOST} ${CONFIG} --openssldir="${ARCH_INSTALL_PATH}" >> "${LOG}" 2>&1 perl -i -pe "s|^CC= gcc|CC= ${CLANG} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET} -arch ${ARCH} -fembed-bitcode |g" Makefile >> "${LOG}" 2>&1 perl -i -pe "s|^CFLAG= (.*)|CFLAG= -isysroot ${SDKROOT} \$1|g" Makefile >> "${LOG}" 2>&1 make >> "${LOG}" 2>&1 make install_sw >> "${LOG}" 2>&1 popd > /dev/null - rm -rf "/tmp/openssl" - BUILT_CRYPTO_PATHS+=("/tmp/openssl-${ARCH}/lib/libcrypto.a") - BUILT_SSL_PATHS+=("/tmp/openssl-${ARCH}/lib/libssl.a") + rm -rf "${ARCH_INSTALL_PATH}/openssl" + + BUILT_CRYPTO_PATHS+=("${ARCH_INSTALL_PATH}/lib/libcrypto.a") + BUILT_SSL_PATHS+=("${ARCH_INSTALL_PATH}/lib/libssl.a") } function fat_binary () { - echo "Building fat binary..." + echo "Copying headers & pkg-config files" + cp -r "${ARCH_INSTALL_PATH}/include/openssl" "${INSTALL_PATH}/include/" + for pkgfile in "${ARCH_INSTALL_PATH}"/lib/pkgconfig/*.pc; do + cp "${pkgfile}" "${INSTALL_PATH}/lib/pkgconfig/" + perl -i -pe "s|^(prefix=${INSTALL_PATH}).*$|\$1|g" "${INSTALL_PATH}/lib/pkgconfig/$(basename "${pkgfile}")" >> "${LOG}" 2>&1 + done - mkdir -p "${ROOT_PATH}/External/ios-openssl/include" - cp -r /tmp/openssl-i386/include/openssl "${ROOT_PATH}/External/ios-openssl/include/" - - mkdir -p "${ROOT_PATH}/External/ios-openssl/lib" + echo "Building fat binary..." - lipo -create "${BUILT_CRYPTO_PATHS[@]}" -output "${ROOT_PATH}/External/ios-openssl/lib/libcrypto.a" - lipo -create "${BUILT_SSL_PATHS[@]}" -output "${ROOT_PATH}/External/ios-openssl/lib/libssl.a" + lipo -create "${BUILT_CRYPTO_PATHS[@]}" -output "${INSTALL_PATH}/lib/libcrypto.a" + lipo -create "${BUILT_SSL_PATHS[@]}" -output "${INSTALL_PATH}/lib/libssl.a" echo "Building done." } -cleanup build_all_archs setup build_ssl fat_binary -cleanup diff --git a/script/xcode_functions.sh b/script/xcode_functions.sh index c9e6980f6..2dc7e3b2c 100755 --- a/script/xcode_functions.sh +++ b/script/xcode_functions.sh @@ -26,7 +26,7 @@ function ios_sdk_version () # iPhoneSimulator9.0.sdk - Simulator - iOS 9.0 (iphonesimulator9.0) # SDKVersion: 9.0 - /usr/bin/xcodebuild -version -sdk 2> /dev/null | grep -A 1 '^iPhone' | tail -n 1 | awk '{ print $2 }' + /usr/bin/xcodebuild -version -sdk 2> /dev/null | grep -A 1 '^iPhone' | tail -n 1 | awk '{ print $2 }' } # Returns the path to the specified iOS SDK name From 47596a7374bf28604af824ce65212bbcbda5ea0c Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 23 Apr 2018 23:01:23 +0200 Subject: [PATCH 191/228] Add brewed openssl libpath to the Mac target --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 223374f95..c89360224 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -1691,6 +1691,7 @@ INFOPLIST_FILE = Info.plist; LIBRARY_SEARCH_PATHS = ( "$(inherited)", + /usr/local/opt/openssl/lib, "$(PROJECT_DIR)/External/build/lib", ); MODULEMAP_FILE = ObjectiveGit.modulemap; @@ -1719,6 +1720,7 @@ INFOPLIST_FILE = Info.plist; LIBRARY_SEARCH_PATHS = ( "$(inherited)", + /usr/local/opt/openssl/lib, "$(PROJECT_DIR)/External/build/lib", ); MODULEMAP_FILE = ObjectiveGit.modulemap; @@ -1958,6 +1960,7 @@ INFOPLIST_FILE = Info.plist; LIBRARY_SEARCH_PATHS = ( "$(inherited)", + /usr/local/opt/openssl/lib, "$(PROJECT_DIR)/External/build/lib", ); MODULEMAP_FILE = ObjectiveGit.modulemap; @@ -2177,6 +2180,7 @@ INFOPLIST_FILE = Info.plist; LIBRARY_SEARCH_PATHS = ( "$(inherited)", + /usr/local/opt/openssl/lib, "$(PROJECT_DIR)/External/build/lib", ); MODULEMAP_FILE = ObjectiveGit.modulemap; From 06a6363b44cfe99f7cc171ff602bb0cdd522628f Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 23 Apr 2018 23:01:25 +0200 Subject: [PATCH 192/228] Manually tell pkg-config the location of brewed OpenSSL --- script/update_libgit2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/script/update_libgit2 b/script/update_libgit2 index d84cb1de1..151231742 100755 --- a/script/update_libgit2 +++ b/script/update_libgit2 @@ -22,6 +22,9 @@ fi mkdir build cd build +# OpenSSL is keg-only, so add its pkgconfig location manually +export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig + cmake -DBUILD_SHARED_LIBS:BOOL=OFF \ -DLIBSSH2_INCLUDE_DIRS:PATH=/usr/local/include/ \ -DBUILD_CLAR:BOOL=OFF \ From c17ebf088f820c5dec2d9b53667f65fbad89a82a Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Fri, 4 May 2018 17:58:40 +0100 Subject: [PATCH 193/228] script: use absolute paths to SCRIPT_DIR --- script/bootstrap | 2 +- script/cibuild | 2 +- script/ios_build_functions.sh | 2 +- script/update_libgit2_ios | 2 +- script/update_libssh2_ios | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/script/bootstrap b/script/bootstrap index ffccf0212..18f76616a 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -1,6 +1,6 @@ #!/bin/bash -export SCRIPT_DIR=$(dirname "$0") +export SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) ## ## Configuration Variables diff --git a/script/cibuild b/script/cibuild index 4f2a1a356..cc58cb660 100755 --- a/script/cibuild +++ b/script/cibuild @@ -33,7 +33,7 @@ fi ## set -o pipefail -SCRIPT_DIR=$(dirname "$0") +SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) XCWORKSPACE="ObjectiveGitFramework.xcworkspace" XCODE_OPTIONS=$(RUN_CLANG_STATIC_ANALYZER=NO ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO) diff --git a/script/ios_build_functions.sh b/script/ios_build_functions.sh index fc7cd8be7..515ca81b1 100755 --- a/script/ios_build_functions.sh +++ b/script/ios_build_functions.sh @@ -1,6 +1,6 @@ #!/bin/bash -SCRIPT_DIR=$(dirname "$0") +SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) source "${SCRIPT_DIR}/xcode_functions.sh" function setup_build_environment () diff --git a/script/update_libgit2_ios b/script/update_libgit2_ios index 7e6d46ef0..141c69665 100755 --- a/script/update_libgit2_ios +++ b/script/update_libgit2_ios @@ -3,7 +3,7 @@ set -e # source the common build functions -SCRIPT_DIR=$(dirname "$0") +SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) source "${SCRIPT_DIR}/ios_build_functions.sh" function setup () diff --git a/script/update_libssh2_ios b/script/update_libssh2_ios index 58283ee35..b015047c5 100755 --- a/script/update_libssh2_ios +++ b/script/update_libssh2_ios @@ -3,7 +3,7 @@ set -e # source the common build functions -SCRIPT_DIR=$(dirname "$0") +SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) source "${SCRIPT_DIR}/ios_build_functions.sh" function setup () From 8d0ce2e184d6ac63ee8a7e22b9f3493fb293e8ab Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Fri, 4 May 2018 18:00:09 +0100 Subject: [PATCH 194/228] script: force static libraries dependencies for iOS --- script/pkg-config-static | 2 ++ script/update_libgit2_ios | 3 +++ 2 files changed, 5 insertions(+) create mode 100755 script/pkg-config-static diff --git a/script/pkg-config-static b/script/pkg-config-static new file mode 100755 index 000000000..64c6ea205 --- /dev/null +++ b/script/pkg-config-static @@ -0,0 +1,2 @@ +#!/bin/sh +pkg-config --static "$@" diff --git a/script/update_libgit2_ios b/script/update_libgit2_ios index 141c69665..2586f128b 100755 --- a/script/update_libgit2_ios +++ b/script/update_libgit2_ios @@ -29,6 +29,9 @@ function build_libgit2 () # LOL Cmake SYS_ROOT="-DCMAKE_OSX_SYSROOT=${SDKROOT}" + # We only want to discover our static library + export PKG_CONFIG="${SCRIPT_DIR}"/pkg-config-static + # Limit pkg-config to what we're currently expecting it to use # PKG_CONFIG_PATH="${INSTALL_PATH}/lib/pkgconfig/" # LDFLAGS="-L $(xcrun --sdk iphoneos --show-sdk-path)/usr/lib" From 6e54d411eeff02b8e7964dc5148b19f42f93995e Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 15 Jun 2018 18:47:48 +0200 Subject: [PATCH 195/228] Update to libgit2 v0.27.2 --- External/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libgit2 b/External/libgit2 index 6311e886d..8d36dc62b 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit 6311e886d8b5377c6037cd9937ccf66a71f3361d +Subproject commit 8d36dc62ba1b5d7deb66b6f982e005ddbc2ce343 From 67f23fbc54689617c6c3e6c985492983d0e7ee8b Mon Sep 17 00:00:00 2001 From: schriftgestalt Date: Fri, 20 Jul 2018 11:43:35 +0200 Subject: [PATCH 196/228] Do not copy .xcconfig file --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index c89360224..4894d348a 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -320,7 +320,6 @@ DD3D951C182AB25C004AF532 /* GTBlameHunk.h in Headers */ = {isa = PBXBuildFile; fileRef = DD3D951A182AB25C004AF532 /* GTBlameHunk.h */; settings = {ATTRIBUTES = (Public, ); }; }; DD3D951D182AB25C004AF532 /* GTBlameHunk.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3D951B182AB25C004AF532 /* GTBlameHunk.m */; }; F81B6B50207B032800AB0836 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63871207AE62A00D1FD32 /* XCTest.framework */; }; - F81B6B55207B0A9F00AB0836 /* Mac-XCTest.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = F81B6B54207B0A9F00AB0836 /* Mac-XCTest.xcconfig */; }; F81B6B59207B0D3B00AB0836 /* SwiftSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0A0129619F9A660007F1914 /* SwiftSpec.swift */; }; F84277BE207B104A008AB8E8 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63872207AE63A00D1FD32 /* XCTest.framework */; }; F86949AA1BF1B79E00A989D3 /* GTUtilityFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0391B4059ED000FF7D0 /* GTUtilityFunctions.m */; }; @@ -1345,7 +1344,6 @@ files = ( 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, F8D6384B207A618D00D1FD32 /* script in Resources */, - F81B6B55207B0A9F00AB0836 /* Mac-XCTest.xcconfig in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; From 52826550bbf60fc978bb1e04a509468f50ec9d72 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Sat, 11 Aug 2018 00:05:18 +0200 Subject: [PATCH 197/228] Update libgit2 to v0.27.4 --- External/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libgit2 b/External/libgit2 index 8d36dc62b..8b89f362a 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit 8d36dc62ba1b5d7deb66b6f982e005ddbc2ce343 +Subproject commit 8b89f362a34fcccdf1c6c5f3445895b71d9c6d56 From 3bb0078f546eecfb037d35faf67a264657979f2c Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Sat, 18 Aug 2018 00:03:22 +0200 Subject: [PATCH 198/228] Let NSString handle the string copy --- ObjectiveGit/GTRepository+Merging.m | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ObjectiveGit/GTRepository+Merging.m b/ObjectiveGit/GTRepository+Merging.m index 4d692fbe2..f7b9837df 100644 --- a/ObjectiveGit/GTRepository+Merging.m +++ b/ObjectiveGit/GTRepository+Merging.m @@ -240,13 +240,7 @@ - (NSString * _Nullable)contentsOfDiffWithAncestor:(GTIndexEntry *)ancestor ourS return nil; } - char *cString = malloc(result.len * sizeof(char *) + 1); - strncpy(cString, result.ptr, result.len); - cString[result.len] = '\0'; - - NSString *mergedContent = [[NSString alloc] initWithCString:cString encoding:NSUTF8StringEncoding]; - - free(cString); + NSString *mergedContent = [[NSString alloc] initWithBytes:result.ptr length:result.len encoding:NSUTF8StringEncoding]; git_merge_file_result_free(&result); From 6374f3bd4edd75a5fa7e33c6b9328e10837c160b Mon Sep 17 00:00:00 2001 From: Alexander Hedges Date: Sat, 8 Sep 2018 13:39:38 +0200 Subject: [PATCH 199/228] Fix bug in isValidRemoteName According to the docs git_remote_is_valid_name returns either 1 (success) or 0. --- ObjectiveGit/GTRemote.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTRemote.m b/ObjectiveGit/GTRemote.m index 2adee7442..03f76b7ca 100644 --- a/ObjectiveGit/GTRemote.m +++ b/ObjectiveGit/GTRemote.m @@ -104,7 +104,7 @@ - (NSString *)description { + (BOOL)isValidRemoteName:(NSString *)name { NSParameterAssert(name != nil); - return git_remote_is_valid_name(name.UTF8String) == GIT_OK; + return (git_remote_is_valid_name(name.UTF8String) == 1 ? YES : NO); } #pragma mark Properties From dfcb8972516d02a8bef9bab77347ddc50ca86423 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 26 Oct 2018 23:20:48 +0200 Subject: [PATCH 200/228] Update libgit2 to v0.27.7 --- External/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libgit2 b/External/libgit2 index 8b89f362a..f23dc5b29 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit 8b89f362a34fcccdf1c6c5f3445895b71d9c6d56 +Subproject commit f23dc5b29f1394928a940d7ec447f4bfd53dad1f From 8cd20959e96cef710597a1bd329c9f8d6df0f2ae Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 26 Mar 2018 22:41:35 +0200 Subject: [PATCH 201/228] Don't put the private key in the error message --- ObjectiveGit/GTCredential.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTCredential.m b/ObjectiveGit/GTCredential.m index beb2d8da0..0ee809b0e 100644 --- a/ObjectiveGit/GTCredential.m +++ b/ObjectiveGit/GTCredential.m @@ -77,7 +77,7 @@ + (instancetype)credentialWithUserName:(NSString *)userName publicKeyString:(NSS git_cred *cred; int gitError = git_cred_ssh_key_memory_new(&cred, userName.UTF8String, publicKeyString.UTF8String, privateKeyString.UTF8String, passphrase.UTF8String); if (gitError != GIT_OK) { - if (error) *error = [NSError git_errorFor:gitError description:@"Failed to create credentials object" failureReason:@"There was an error creating a credential object for username %@ with the provided public/private key pair.\nPublic key: %@\nPrivate key: %@", userName, publicKeyString, privateKeyString]; + if (error) *error = [NSError git_errorFor:gitError description:@"Failed to create credentials object" failureReason:@"There was an error creating a credential object for username %@ with the provided public/private key pair.\nPublic key: %@", userName, publicKeyString]; return nil; } From b771ce2ea4c74883b4fd8b02929ff7228366ce1c Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Sat, 27 Oct 2018 02:20:56 +0200 Subject: [PATCH 202/228] Update to OpenSSL 1.0.2p --- External/openssl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/openssl b/External/openssl index 3ce7bc40a..e71ebf275 160000 --- a/External/openssl +++ b/External/openssl @@ -1 +1 @@ -Subproject commit 3ce7bc40a3c48da1c96c2d04c10045bd797c6aa3 +Subproject commit e71ebf275da66dfd601c92e0e80a35114c32f6f8 From 6b956f8b928fa97df92e0359c7d7454c740634b5 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Thu, 27 Sep 2018 21:43:12 +0200 Subject: [PATCH 203/228] Do not copy script folder into built framework --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 4894d348a..66b9339a3 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -365,7 +365,6 @@ F8D1BDEF1B31FE7C00CDEC90 /* GTRepository+Pull.h in Headers */ = {isa = PBXBuildFile; fileRef = F8D1BDEC1B31FE7C00CDEC90 /* GTRepository+Pull.h */; settings = {ATTRIBUTES = (Public, ); }; }; F8D1BDF01B31FE7C00CDEC90 /* GTRepository+Pull.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */; }; F8D1BDF11B31FE7C00CDEC90 /* GTRepository+Pull.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */; }; - F8D6384B207A618D00D1FD32 /* script in Resources */ = {isa = PBXBuildFile; fileRef = F8D6384A207A618D00D1FD32 /* script */; }; F8D6385C207AC74A00D1FD32 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D6385B207AC74A00D1FD32 /* libiconv.tbd */; }; F8D6385D207AC75100D1FD32 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BB67BB1C7DF45300A37A66 /* libz.tbd */; }; F8D6385F207ACAE600D1FD32 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D6385E207ACAE600D1FD32 /* libz.tbd */; }; @@ -1343,7 +1342,6 @@ buildActionMask = 2147483647; files = ( 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, - F8D6384B207A618D00D1FD32 /* script in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; From ce5904092d327584e2041f38b69bcae3be68ac14 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 26 Oct 2018 21:04:21 +0000 Subject: [PATCH 204/228] Package non-system libraries inside the framework This automatically copies libssl & libcrypto inside our framework bundle. --- .../project.pbxproj | 15 +++ script/repackage-dylibs.rb | 110 ++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100755 script/repackage-dylibs.rb diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 66b9339a3..5043f44c4 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -1225,6 +1225,7 @@ 79262F0F13C697BE00A4B1EA /* Copy git2 Headers */, BEF7E4DF1A3A47450035BB8E /* Copy git2 Headers again */, 8DC2EF500486A6940098B216 /* Headers */, + 4D751E9D215D765D003CD3CE /* Package external libraries */, ); buildRules = ( ); @@ -1356,6 +1357,20 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 4D751E9D215D765D003CD3CE /* Package external libraries */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Package external libraries"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "./script/repackage-dylibs.rb"; + }; 6A28265317C69CB400C6A948 /* OpenSSL-iOS */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/script/repackage-dylibs.rb b/script/repackage-dylibs.rb new file mode 100755 index 000000000..c594a76ac --- /dev/null +++ b/script/repackage-dylibs.rb @@ -0,0 +1,110 @@ +#!/usr/bin/ruby + +# This script looks up an executable's list of shared libraries, copies +# non-standard ones (ie. anything not under /usr or /System/) into the target's +# bundle and updates the executable install_name to point to the "packaged" +# version. + +# Usage: +# Add the script as a Run Script build phase in the target using Xcode. + +# FIXMEs: +# - only handles dylibs +# - only tested against a framework target +# - doesn't care about codesigning + + +require 'fileutils' +require 'ostruct' + +def err(msg) + puts "error: " + msg + exit 1 +end + +def warn(msg) + puts "warning: " + msg +end + +def note(msg) + puts "note: " + msg +end + +envvars = %w( + TARGET_BUILD_DIR + EXECUTABLE_PATH + FRAMEWORKS_FOLDER_PATH +) + +envvars.each do |var| + raise "Must be run in an Xcode Run Phase" unless ENV[var] + Kernel.const_set var, ENV[var] +end + +TARGET_EXECUTABLE_PATH = File.join(TARGET_BUILD_DIR, EXECUTABLE_PATH) +TARGET_FRAMEWORKS_PATH = File.join(TARGET_BUILD_DIR, FRAMEWORKS_FOLDER_PATH) + +def extract_link_dependencies + deps = `otool -L #{TARGET_EXECUTABLE_PATH}` + + lines = deps.split("\n").map(&:strip) + lines.shift + lines.shift + lines.map do |dep| + path, compat, current = /^(.*) \(compatibility version (.*), current version (.*)\)$/.match(dep)[1..3] + err "Failed to parse #{dep}" if path.nil? + + dep = OpenStruct.new + dep.install_name = path + dep.current_version = current + dep.compat_version = compat + dep.type = File.extname(path) + dep.name = File.basename(path) + dep.is_packaged = (dep.install_name =~ /^@rpath/) + dep.path = if dep.install_name =~ /^@rpath/ + File.join(TARGET_FRAMEWORKS_PATH, dep.name) + else + dep.install_name + end + + dep + end +end + +def repackage_dependency(dep) + return if dep.is_packaged or dep.path =~ /^(\/usr\/lib|\/System\/Library)/ + + note "Packaging #{dep.name}…" + + FileUtils.mkdir(TARGET_FRAMEWORKS_PATH) unless Dir.exist?(TARGET_FRAMEWORKS_PATH) + + case dep.type + when ".dylib" + if File.exist?(File.join(TARGET_FRAMEWORKS_PATH, dep.name)) + warn "#{dep.path} already in Frameworks directory, removing" + FileUtils.rm File.join(TARGET_FRAMEWORKS_PATH, dep.name) + end + + note "Copying #{dep[:path]} to TARGET_FRAMEWORKS_PATH" + FileUtils.cp dep[:path], TARGET_FRAMEWORKS_PATH + + out = `install_name_tool -change #{dep.path} "@rpath/#{dep.name}" #{TARGET_EXECUTABLE_PATH}` + if $? != 0 + err "install_name_tool failed with error #{$?}:\n#{out}" + end + + dep.path = File.join(TARGET_FRAMEWORKS_PATH, dep.name) + dep.install_name = "@rpath/#{dep.name}" + dep.is_packaged = true + + else + warn "Unhandled type #{dep.type} for #{dep.path}, ignoring" + end +end + +extract_link_dependencies.each do |dep| + repackage_dependency dep +end + +note "Packaging done" +exit 0 From 24c21ca9deaea71538baac32b9f664d2c10cbe85 Mon Sep 17 00:00:00 2001 From: Ken Harris Date: Wed, 31 Oct 2018 11:34:28 -0700 Subject: [PATCH 205/228] Add header files to exclusion list in ObjectiveGit.modulemap --- ObjectiveGit.modulemap | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ObjectiveGit.modulemap b/ObjectiveGit.modulemap index bb441d417..3ef32bc58 100644 --- a/ObjectiveGit.modulemap +++ b/ObjectiveGit.modulemap @@ -129,6 +129,7 @@ framework module ObjectiveGit { exclude header "git2/sys/git2/sys/hashsig.h" exclude header "git2/sys/git2/sys/index.h" exclude header "git2/sys/git2/sys/mempack.h" + exclude header "git2/sys/git2/sys/merge.h" exclude header "git2/sys/git2/sys/odb_backend.h" exclude header "git2/sys/git2/sys/openssl.h" exclude header "git2/sys/git2/sys/refdb_backend.h" @@ -136,7 +137,9 @@ framework module ObjectiveGit { exclude header "git2/sys/git2/sys/refs.h" exclude header "git2/sys/git2/sys/repository.h" exclude header "git2/sys/git2/sys/stream.h" + exclude header "git2/sys/git2/sys/time.h" exclude header "git2/sys/git2/sys/transport.h" + exclude header "git2/sys/git2/sys/worktree.h" export * module * { export * } From cdac5076cb7adecdf626772e9222f56a3ff1936e Mon Sep 17 00:00:00 2001 From: Yori Mihalakopoulos Date: Wed, 7 Nov 2018 20:01:10 +1100 Subject: [PATCH 206/228] Free the branch iterator --- ObjectiveGit/GTRepository.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index cd4fce6b8..dde113c2c 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -407,6 +407,10 @@ - (BOOL)enumerateBranchesWithType:(GTBranchType)type error:(NSError **)error usi if (error) *error = [NSError git_errorFor:gitError description:@"Branch enumeration failed"]; return NO; } + + @onExit { + git_branch_iterator_free(iter); + }; git_branch_t branchType; while ((gitError = git_branch_next(&gitRef, &branchType, iter)) == GIT_OK) { From cfb487c421ab65b3f04904a0d41aff44adcd8a36 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Sun, 18 Nov 2018 17:15:40 +0100 Subject: [PATCH 207/228] Fix nullability warnings introduced in Xcode 10 --- ObjectiveGit/GTBlameHunk.m | 4 +++- ObjectiveGit/GTConfiguration.m | 5 ++++- ObjectiveGit/GTDiffFile.m | 5 +++-- ObjectiveGit/GTFilterSource.m | 11 +++++++---- ObjectiveGit/GTIndexEntry.m | 4 +++- ObjectiveGit/GTNote.m | 4 +++- ObjectiveGit/GTReference.m | 8 +++++--- ObjectiveGit/GTRepository+RemoteOperations.m | 10 ++++++++-- ObjectiveGit/GTRepository.m | 20 +++++++++++++------- ObjectiveGit/GTSubmodule.m | 15 ++++++++++++--- ObjectiveGit/GTTag.m | 8 ++++++-- ObjectiveGit/GTTreeEntry.m | 4 +++- 12 files changed, 70 insertions(+), 28 deletions(-) diff --git a/ObjectiveGit/GTBlameHunk.m b/ObjectiveGit/GTBlameHunk.m index 3be7dd4da..9c136fc70 100644 --- a/ObjectiveGit/GTBlameHunk.m +++ b/ObjectiveGit/GTBlameHunk.m @@ -39,7 +39,9 @@ - (GTSignature *)finalSignature { } - (NSString *)originalPath { - return @(self.git_blame_hunk.orig_path); + NSString *path = @(self.git_blame_hunk.orig_path); + NSAssert(path, @"string was nil"); + return path; } - (BOOL)isBoundary { diff --git a/ObjectiveGit/GTConfiguration.m b/ObjectiveGit/GTConfiguration.m index 940753cf9..acd46cd74 100644 --- a/ObjectiveGit/GTConfiguration.m +++ b/ObjectiveGit/GTConfiguration.m @@ -112,7 +112,10 @@ - (BOOL)deleteValueForKey:(NSString *)key error:(NSError **)error { static int configCallback(const git_config_entry *entry, void *payload) { NSMutableArray *configurationKeysArray = (__bridge NSMutableArray *)payload; - [configurationKeysArray addObject:@(entry->name)]; + NSString *name = @(entry->name); + NSCAssert(name, @"string was nil"); + + [configurationKeysArray addObject:name]; return 0; } diff --git a/ObjectiveGit/GTDiffFile.m b/ObjectiveGit/GTDiffFile.m index 135f758a0..24b3c7b11 100644 --- a/ObjectiveGit/GTDiffFile.m +++ b/ObjectiveGit/GTDiffFile.m @@ -22,8 +22,9 @@ - (instancetype)initWithGitDiffFile:(git_diff_file)file { self = [super init]; if (self == nil) return nil; - _path = @(file.path); - if (_path == nil) return nil; + NSString *path = @(file.path); + if (path == nil) return nil; + _path = path; _git_diff_file = file; _size = (NSUInteger)file.size; diff --git a/ObjectiveGit/GTFilterSource.m b/ObjectiveGit/GTFilterSource.m index 91de241b3..65878319f 100644 --- a/ObjectiveGit/GTFilterSource.m +++ b/ObjectiveGit/GTFilterSource.m @@ -27,10 +27,13 @@ - (instancetype)initWithGitFilterSource:(const git_filter_source *)source { self = [super init]; if (self == nil) return nil; - const char *path = git_repository_workdir(git_filter_source_repo(source)); - _repositoryURL = [NSURL fileURLWithPath:@(path)]; - - _path = @(git_filter_source_path(source)); + NSString *path = @(git_repository_workdir(git_filter_source_repo(source))); + NSAssert(path, @"workdir was nil"); + _repositoryURL = [NSURL fileURLWithPath:path]; + + path = @(git_filter_source_path(source)); + NSAssert(path, @"path was nil"); + _path = path; const git_oid *gitOid = git_filter_source_id(source); if (gitOid != NULL) _OID = [[GTOID alloc] initWithGitOid:gitOid]; diff --git a/ObjectiveGit/GTIndexEntry.m b/ObjectiveGit/GTIndexEntry.m index a218ed398..855393c3d 100644 --- a/ObjectiveGit/GTIndexEntry.m +++ b/ObjectiveGit/GTIndexEntry.m @@ -74,7 +74,9 @@ - (instancetype)initWithGitIndexEntry:(const git_index_entry *)entry { #pragma mark Properties - (NSString *)path { - return @(self.git_index_entry->path); + NSString *path = @(self.git_index_entry->path); + NSAssert(path, @"path is nil"); + return path; } - (int)flags { diff --git a/ObjectiveGit/GTNote.m b/ObjectiveGit/GTNote.m index 0c18fe2b5..4562b0845 100644 --- a/ObjectiveGit/GTNote.m +++ b/ObjectiveGit/GTNote.m @@ -42,7 +42,9 @@ - (git_note *)git_note { } - (NSString *)note { - return @(git_note_message(self.git_note)); + NSString *message = @(git_note_message(self.git_note)); + NSAssert(message, @"message is nil"); + return message; } - (GTSignature *)author { diff --git a/ObjectiveGit/GTReference.m b/ObjectiveGit/GTReference.m index bdb0fb13a..2baacdacb 100644 --- a/ObjectiveGit/GTReference.m +++ b/ObjectiveGit/GTReference.m @@ -118,10 +118,12 @@ - (BOOL)isNote { } - (NSString *)name { - const char *refName = git_reference_name(self.git_reference); - NSAssert(refName != nil, @"Unexpected nil name"); + const char *cRefName = git_reference_name(self.git_reference); + NSAssert(cRefName != nil, @"Unexpected nil name"); - return @(refName); + NSString *refName = @(cRefName); + NSAssert(refName, @"refname is nil"); + return refName; } - (GTReference *)referenceByRenaming:(NSString *)newName error:(NSError **)error { diff --git a/ObjectiveGit/GTRepository+RemoteOperations.m b/ObjectiveGit/GTRepository+RemoteOperations.m index 57c92096a..822171ab9 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.m +++ b/ObjectiveGit/GTRepository+RemoteOperations.m @@ -126,9 +126,15 @@ int GTFetchHeadEntriesCallback(const char *ref_name, const char *remote_url, con GTRepository *repository = entriesPayload->repository; GTRemoteEnumerateFetchHeadEntryBlock enumerationBlock = entriesPayload->enumerationBlock; - GTReference *reference = [repository lookUpReferenceWithName:@(ref_name) error:NULL]; + NSString *refName = @(ref_name); + NSCAssert(refName, @"refName is nil"); - GTFetchHeadEntry *entry = [[GTFetchHeadEntry alloc] initWithReference:reference remoteURLString:@(remote_url) targetOID:[GTOID oidWithGitOid:oid] isMerge:(BOOL)is_merge]; + NSString *remoteURL = @(remote_url); + NSCAssert(remote_url, @"remoteURL is nil"); + + GTReference *reference = [repository lookUpReferenceWithName:refName error:NULL]; + + GTFetchHeadEntry *entry = [[GTFetchHeadEntry alloc] initWithReference:reference remoteURLString:remoteURL targetOID:[GTOID oidWithGitOid:oid] isMerge:(BOOL)is_merge]; BOOL stop = NO; diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index dde113c2c..851d81c28 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -637,18 +637,22 @@ - (NSArray *)referenceNamesWithError:(NSError **)error { } - (NSURL *)fileURL { - const char *path = git_repository_workdir(self.git_repository); + const char *cPath = git_repository_workdir(self.git_repository); // bare repository, you may be looking for gitDirectoryURL - if (path == NULL) return nil; + if (cPath == NULL) return nil; - return [NSURL fileURLWithPath:@(path) isDirectory:YES]; + NSString *path = @(cPath); + NSAssert(path, @"workdir is nil"); + return [NSURL fileURLWithPath:path isDirectory:YES]; } - (NSURL *)gitDirectoryURL { - const char *path = git_repository_path(self.git_repository); - if (path == NULL) return nil; + const char *cPath = git_repository_path(self.git_repository); + if (cPath == NULL) return nil; - return [NSURL fileURLWithPath:@(path) isDirectory:YES]; + NSString *path = @(cPath); + NSAssert(path, @"gitdirectory is nil"); + return [NSURL fileURLWithPath:path isDirectory:YES]; } - (BOOL)isBare { @@ -737,7 +741,9 @@ static int submoduleEnumerationCallback(git_submodule *git_submodule, const char NSError *error; // Use -submoduleWithName:error: so that we get a git_submodule that we own. - GTSubmodule *submodule = [info->parentRepository submoduleWithName:@(name) error:&error]; + NSString *submoduleName = @(name); + NSCAssert(submoduleName, @"submodule name is nil"); + GTSubmodule *submodule = [info->parentRepository submoduleWithName:submoduleName error:&error]; BOOL stop = NO; info->block(submodule, error, &stop); diff --git a/ObjectiveGit/GTSubmodule.m b/ObjectiveGit/GTSubmodule.m index 968920d83..5d61b20c2 100644 --- a/ObjectiveGit/GTSubmodule.m +++ b/ObjectiveGit/GTSubmodule.m @@ -62,21 +62,30 @@ - (NSString *)name { const char *cName = git_submodule_name(self.git_submodule); NSAssert(cName != NULL, @"Unexpected nil submodule name"); - return @(cName); + NSString *name = @(cName); + NSAssert(name, @"name is nil"); + + return name; } - (NSString *)path { const char *cPath = git_submodule_path(self.git_submodule); NSAssert(cPath != NULL, @"Unexpected nil submodule path"); - return @(cPath); + NSString *path = @(cPath); + NSAssert(path, @"message is nil"); + + return path; } - (NSString *)URLString { const char *cURL = git_submodule_url(self.git_submodule); NSAssert(cURL != NULL, @"Unexpected nil submodule URL"); - return @(cURL); + NSString *URL = @(cURL); + NSAssert(URL, @"URL is nil"); + + return URL; } #pragma mark Lifecycle diff --git a/ObjectiveGit/GTTag.m b/ObjectiveGit/GTTag.m index 3c8c617c8..e2cd31a94 100644 --- a/ObjectiveGit/GTTag.m +++ b/ObjectiveGit/GTTag.m @@ -47,11 +47,15 @@ - (NSString *)description { #pragma mark API - (NSString *)message { - return @(git_tag_message(self.git_tag)); + NSString *message = @(git_tag_message(self.git_tag)); + NSAssert(message, @"message is nil"); + return message; } - (NSString *)name { - return @(git_tag_name(self.git_tag)); + NSString *name = @(git_tag_name(self.git_tag)); + NSAssert(name, @"message is nil"); + return name; } - (GTObject *)target { diff --git a/ObjectiveGit/GTTreeEntry.m b/ObjectiveGit/GTTreeEntry.m index 809ae0eae..946b1f06f 100644 --- a/ObjectiveGit/GTTreeEntry.m +++ b/ObjectiveGit/GTTreeEntry.m @@ -94,7 +94,9 @@ + (instancetype)entryWithEntry:(const git_tree_entry *)theEntry parentTree:(GTTr } - (NSString *)name { - return @(git_tree_entry_name(self.git_tree_entry)); + NSString *name = @(git_tree_entry_name(self.git_tree_entry)); + NSAssert(name, @"name was nil"); + return name; } - (NSInteger)attributes { From 7966189f48e4c4598ae14d29854d6b6d8d6d550e Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Tue, 20 Nov 2018 21:33:54 +0100 Subject: [PATCH 208/228] Also fixup dependencies names & ids --- script/repackage-dylibs.rb | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/script/repackage-dylibs.rb b/script/repackage-dylibs.rb index c594a76ac..6f2a34719 100755 --- a/script/repackage-dylibs.rb +++ b/script/repackage-dylibs.rb @@ -44,23 +44,25 @@ def note(msg) TARGET_EXECUTABLE_PATH = File.join(TARGET_BUILD_DIR, EXECUTABLE_PATH) TARGET_FRAMEWORKS_PATH = File.join(TARGET_BUILD_DIR, FRAMEWORKS_FOLDER_PATH) -def extract_link_dependencies - deps = `otool -L #{TARGET_EXECUTABLE_PATH}` +def extract_link_dependencies(executable) + deps = `otool -L #{executable}` lines = deps.split("\n").map(&:strip) lines.shift - lines.shift + # lines.shift lines.map do |dep| path, compat, current = /^(.*) \(compatibility version (.*), current version (.*)\)$/.match(dep)[1..3] err "Failed to parse #{dep}" if path.nil? dep = OpenStruct.new + dep.is_self = (File.basename(path) == File.basename(executable)) + dep.executable = executable dep.install_name = path dep.current_version = current dep.compat_version = compat dep.type = File.extname(path) dep.name = File.basename(path) - dep.is_packaged = (dep.install_name =~ /^@rpath/) + dep.is_packaged = !!(dep.install_name =~ /^@rpath/) dep.path = if dep.install_name =~ /^@rpath/ File.join(TARGET_FRAMEWORKS_PATH, dep.name) else @@ -72,7 +74,7 @@ def extract_link_dependencies end def repackage_dependency(dep) - return if dep.is_packaged or dep.path =~ /^(\/usr\/lib|\/System\/Library)/ + return if dep.is_self or dep.is_packaged or dep.path =~ /^(\/usr\/lib|\/System\/Library)/ note "Packaging #{dep.name}…" @@ -88,7 +90,7 @@ def repackage_dependency(dep) note "Copying #{dep[:path]} to TARGET_FRAMEWORKS_PATH" FileUtils.cp dep[:path], TARGET_FRAMEWORKS_PATH - out = `install_name_tool -change #{dep.path} "@rpath/#{dep.name}" #{TARGET_EXECUTABLE_PATH}` + out = `install_name_tool -change #{dep.path} "@rpath/#{dep.name}" #{dep.executable}` if $? != 0 err "install_name_tool failed with error #{$?}:\n#{out}" end @@ -96,14 +98,24 @@ def repackage_dependency(dep) dep.path = File.join(TARGET_FRAMEWORKS_PATH, dep.name) dep.install_name = "@rpath/#{dep.name}" dep.is_packaged = true - else warn "Unhandled type #{dep.type} for #{dep.path}, ignoring" end end -extract_link_dependencies.each do |dep| +def fix_install_id(dep) + note "Fixing #{dep.name} install_name id…" + out = `install_name_tool -id @rpath/#{dep.name} #{dep.executable}` + if $? != 0 + err "install_name_tool failed with error #{$?}:\n#{out}" + end +end + +deps = extract_link_dependencies(TARGET_EXECUTABLE_PATH) +while (dep = deps.shift) do repackage_dependency dep + fix_install_id dep if dep.is_self and dep.executable != TARGET_EXECUTABLE_PATH + deps += extract_link_dependencies(dep[:path]) if dep.is_packaged and not dep.is_self end note "Packaging done" From da034f6e7e82f2c4fae17488b08dd4154b60c974 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Mon, 28 Jan 2019 17:56:41 +0100 Subject: [PATCH 209/228] Fix permissions while packaging binaries --- script/repackage-dylibs.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/script/repackage-dylibs.rb b/script/repackage-dylibs.rb index 6f2a34719..f6b35a300 100755 --- a/script/repackage-dylibs.rb +++ b/script/repackage-dylibs.rb @@ -79,23 +79,25 @@ def repackage_dependency(dep) note "Packaging #{dep.name}…" FileUtils.mkdir(TARGET_FRAMEWORKS_PATH) unless Dir.exist?(TARGET_FRAMEWORKS_PATH) + packaged_path = File.join(TARGET_FRAMEWORKS_PATH, dep.name) case dep.type when ".dylib" - if File.exist?(File.join(TARGET_FRAMEWORKS_PATH, dep.name)) + if File.exist? packaged_path warn "#{dep.path} already in Frameworks directory, removing" - FileUtils.rm File.join(TARGET_FRAMEWORKS_PATH, dep.name) + FileUtils.rm packaged_path end note "Copying #{dep[:path]} to TARGET_FRAMEWORKS_PATH" FileUtils.cp dep[:path], TARGET_FRAMEWORKS_PATH + FileUtils.chmod "u=rw", packaged_path out = `install_name_tool -change #{dep.path} "@rpath/#{dep.name}" #{dep.executable}` if $? != 0 err "install_name_tool failed with error #{$?}:\n#{out}" end - dep.path = File.join(TARGET_FRAMEWORKS_PATH, dep.name) + dep.path = packaged_path dep.install_name = "@rpath/#{dep.name}" dep.is_packaged = true else From a9cd846cfdedaaa389bc5ffc409ad32ae28fc3c5 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Sun, 3 Feb 2019 17:05:35 +0100 Subject: [PATCH 210/228] Update Carthage dependencies --- Cartfile.private | 6 +++--- Cartfile.resolved | 6 +++--- Carthage/Checkouts/Nimble | 2 +- Carthage/Checkouts/Quick | 2 +- Carthage/Checkouts/ZipArchive | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cartfile.private b/Cartfile.private index 476c2a1f6..0dfa9b497 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,4 +1,4 @@ github "jspahrsummers/xcconfigs" "master" -github "Quick/Quick" ~> 1.2.0 -github "Quick/Nimble" ~> 7.1.0 -github "ZipArchive/ZipArchive" ~> 2.1.2 +github "Quick/Quick" ~> 1.3.4 +github "Quick/Nimble" ~> 7.3.3 +github "ZipArchive/ZipArchive" ~> 2.1.4 diff --git a/Cartfile.resolved b/Cartfile.resolved index ef51bc1cb..36c5288e0 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ -github "Quick/Nimble" "v7.1.0" -github "Quick/Quick" "v1.2.0" -github "ZipArchive/ZipArchive" "v2.1.2" +github "Quick/Nimble" "v7.3.3" +github "Quick/Quick" "v1.3.4" +github "ZipArchive/ZipArchive" "v2.1.4" github "jspahrsummers/xcconfigs" "bb795558a76e5daf3688500055bbcfe243bffa8d" diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble index 5e11474ae..9a281b1cf 160000 --- a/Carthage/Checkouts/Nimble +++ b/Carthage/Checkouts/Nimble @@ -1 +1 @@ -Subproject commit 5e11474ae6ea796a07e722fea49269d26710744d +Subproject commit 9a281b1cfa1c53d1e8bd92e1798e4e473af8d263 diff --git a/Carthage/Checkouts/Quick b/Carthage/Checkouts/Quick index 0ff81f2c6..f2b5a0644 160000 --- a/Carthage/Checkouts/Quick +++ b/Carthage/Checkouts/Quick @@ -1 +1 @@ -Subproject commit 0ff81f2c665b4381f526bd656f8708dd52a9ea2f +Subproject commit f2b5a06440ea87eba1a167cab37bf6496646c52e diff --git a/Carthage/Checkouts/ZipArchive b/Carthage/Checkouts/ZipArchive index 3ad651c62..e8b08ceb6 160000 --- a/Carthage/Checkouts/ZipArchive +++ b/Carthage/Checkouts/ZipArchive @@ -1 +1 @@ -Subproject commit 3ad651c62c059102acc7384dae6b0d4e0142e990 +Subproject commit e8b08ceb6ab9ff56e0826913b13680a129a92828 From 7ab537e53f81b18d6afc6732405c200842fe8179 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 8 Feb 2019 23:36:17 +0100 Subject: [PATCH 211/228] Update to libgit2 v0.28.0-rc1 --- External/libgit2 | 2 +- ObjectiveGit/Categories/NSData+Git.m | 2 +- ObjectiveGit/Categories/NSError+Git.m | 4 ++-- ObjectiveGit/GTBlob.m | 2 +- ObjectiveGit/GTCredential.m | 4 ++-- ObjectiveGit/GTDiffPatch.m | 2 +- ObjectiveGit/GTIndexEntry.m | 2 +- ObjectiveGit/GTNote.m | 2 +- ObjectiveGit/GTOID.m | 2 +- ObjectiveGit/GTObject.h | 18 ++++++++---------- ObjectiveGit/GTObject.m | 14 +++++++------- ObjectiveGit/GTObjectDatabase.m | 2 +- ObjectiveGit/GTReference.h | 6 +++--- ObjectiveGit/GTReference.m | 8 ++++---- ObjectiveGit/GTRepository.m | 6 +++--- ObjectiveGit/GTTreeBuilder.m | 2 +- ObjectiveGitTests/GTReferenceSpec.m | 6 +++--- ObjectiveGitTests/GTRepositorySpec.m | 6 +++--- 18 files changed, 44 insertions(+), 46 deletions(-) diff --git a/External/libgit2 b/External/libgit2 index f23dc5b29..1a107fac0 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit f23dc5b29f1394928a940d7ec447f4bfd53dad1f +Subproject commit 1a107fac0fc88a4d74b64ffc9ae2fd178ba631c0 diff --git a/ObjectiveGit/Categories/NSData+Git.m b/ObjectiveGit/Categories/NSData+Git.m index 2f06dd9fc..6498dfbe0 100644 --- a/ObjectiveGit/Categories/NSData+Git.m +++ b/ObjectiveGit/Categories/NSData+Git.m @@ -17,7 +17,7 @@ - (BOOL)git_getOid:(git_oid *)oid error:(NSError **)error { if ([self length] != sizeof(git_oid)) { if (error != NULL) { *error = [NSError errorWithDomain:GTGitErrorDomain - code:GITERR_INVALID + code:GIT_ERROR_INVALID userInfo: [NSDictionary dictionaryWithObject:@"can't extract oid from data of incorrect length" forKey:NSLocalizedDescriptionKey]]; diff --git a/ObjectiveGit/Categories/NSError+Git.m b/ObjectiveGit/Categories/NSError+Git.m index e66d2fcb3..422b32d1f 100644 --- a/ObjectiveGit/Categories/NSError+Git.m +++ b/ObjectiveGit/Categories/NSError+Git.m @@ -98,10 +98,10 @@ + (NSError *)git_errorFor:(int)code { } + (NSString *)git_descriptionForErrorCode:(int)code { - const git_error *gitLastError = giterr_last(); + const git_error *gitLastError = git_error_last(); if (gitLastError != NULL) { return @(gitLastError->message); - } else if (code == GITERR_OS) { + } else if (code == GIT_ERROR_OS) { return @(strerror(errno)); } else { return nil; diff --git a/ObjectiveGit/GTBlob.m b/ObjectiveGit/GTBlob.m index 1f1e5213c..a1634dcf5 100644 --- a/ObjectiveGit/GTBlob.m +++ b/ObjectiveGit/GTBlob.m @@ -63,7 +63,7 @@ - (instancetype)initWithOid:(const git_oid *)oid inRepository:(GTRepository *)re NSParameterAssert(repository != nil); git_object *obj; - int gitError = git_object_lookup(&obj, repository.git_repository, oid, (git_otype) GTObjectTypeBlob); + int gitError = git_object_lookup(&obj, repository.git_repository, oid, (git_object_t) GTObjectTypeBlob); if (gitError < GIT_OK) { if (error != NULL) { *error = [NSError git_errorFor:gitError description:@"Failed to lookup blob"]; diff --git a/ObjectiveGit/GTCredential.m b/ObjectiveGit/GTCredential.m index 0ee809b0e..1d3894b44 100644 --- a/ObjectiveGit/GTCredential.m +++ b/ObjectiveGit/GTCredential.m @@ -105,7 +105,7 @@ int GTCredentialAcquireCallback(git_cred **git_cred, const char *url, const char GTCredentialProvider *provider = info->credProvider; if (provider == nil) { - giterr_set_str(GIT_EUSER, "No GTCredentialProvider set, but authentication was requested."); + git_error_set_str(GIT_EUSER, "No GTCredentialProvider set, but authentication was requested."); return GIT_ERROR; } @@ -114,7 +114,7 @@ int GTCredentialAcquireCallback(git_cred **git_cred, const char *url, const char GTCredential *cred = [provider credentialForType:(GTCredentialType)allowed_types URL:URL userName:userName]; if (cred == nil) { - giterr_set_str(GIT_EUSER, "GTCredentialProvider failed to provide credentials."); + git_error_set_str(GIT_EUSER, "GTCredentialProvider failed to provide credentials."); return GIT_ERROR; } diff --git a/ObjectiveGit/GTDiffPatch.m b/ObjectiveGit/GTDiffPatch.m index fe28d662a..715db5a13 100644 --- a/ObjectiveGit/GTDiffPatch.m +++ b/ObjectiveGit/GTDiffPatch.m @@ -69,7 +69,7 @@ - (NSData *)patchData { git_patch_to_buf(&buf, self.git_patch); NSData *buffer = [[NSData alloc] initWithBytes:buf.ptr length:buf.size]; - git_buf_free(&buf); + git_buf_dispose(&buf); return buffer; } diff --git a/ObjectiveGit/GTIndexEntry.m b/ObjectiveGit/GTIndexEntry.m index 855393c3d..c687d0060 100644 --- a/ObjectiveGit/GTIndexEntry.m +++ b/ObjectiveGit/GTIndexEntry.m @@ -127,7 +127,7 @@ + (instancetype)objectWithIndexEntry:(GTIndexEntry *)indexEntry error:(NSError * - (instancetype)initWithIndexEntry:(GTIndexEntry *)indexEntry error:(NSError **)error { git_object *obj; - int gitError = git_object_lookup(&obj, indexEntry.repository.git_repository, indexEntry.OID.git_oid, (git_otype)GTObjectTypeAny); + int gitError = git_object_lookup(&obj, indexEntry.repository.git_repository, indexEntry.OID.git_oid, (git_object_t)GTObjectTypeAny); if (gitError < GIT_OK) { if (error != NULL) { diff --git a/ObjectiveGit/GTNote.m b/ObjectiveGit/GTNote.m index 4562b0845..b87039de1 100644 --- a/ObjectiveGit/GTNote.m +++ b/ObjectiveGit/GTNote.m @@ -98,7 +98,7 @@ + (NSString *)defaultReferenceNameForRepository:(GTRepository *)repository error if (error != NULL) *error = [NSError git_errorFor:GIT_ERROR description:@"Unable to get default git notes reference name"]; } - git_buf_free(&default_ref_name); + git_buf_dispose(&default_ref_name); return noteRef; } diff --git a/ObjectiveGit/GTOID.m b/ObjectiveGit/GTOID.m index c97da8735..8010c2885 100644 --- a/ObjectiveGit/GTOID.m +++ b/ObjectiveGit/GTOID.m @@ -133,7 +133,7 @@ + (instancetype)OIDByHashingData:(NSData *)data type:(GTObjectType)type error:(N NSParameterAssert(data != nil); git_oid oid; - int gitError = git_odb_hash(&oid, data.bytes, data.length, (git_otype)type); + int gitError = git_odb_hash(&oid, data.bytes, data.length, (git_object_t)type); if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to hash"]; return nil; diff --git a/ObjectiveGit/GTObject.h b/ObjectiveGit/GTObject.h index 66ef8b89c..a74ed418c 100644 --- a/ObjectiveGit/GTObject.h +++ b/ObjectiveGit/GTObject.h @@ -31,16 +31,14 @@ #import "git2/types.h" typedef NS_ENUM(int, GTObjectType) { - GTObjectTypeAny = GIT_OBJ_ANY, /**< Object can be any of the following */ - GTObjectTypeBad = GIT_OBJ_BAD, /**< Object is invalid. */ - GTObjectTypeExt1 = GIT_OBJ__EXT1, /**< Reserved for future use. */ - GTObjectTypeCommit = GIT_OBJ_COMMIT, /**< A commit object. */ - GTObjectTypeTree = GIT_OBJ_TREE, /**< A tree (directory listing) object. */ - GTObjectTypeBlob = GIT_OBJ_BLOB, /**< A file revision object. */ - GTObjectTypeTag = GIT_OBJ_TAG, /**< An annotated tag object. */ - GTObjectTypeExt2 = GIT_OBJ__EXT2, /**< Reserved for future use. */ - GTObjectTypeOffsetDelta = GIT_OBJ_OFS_DELTA,/**< A delta, base is given by an offset. */ - GTObjectTypeRefDelta = GIT_OBJ_REF_DELTA, /**< A delta, base is given by object id. */ + GTObjectTypeAny = GIT_OBJECT_ANY, /**< Object can be any of the following */ + GTObjectTypeBad = GIT_OBJECT_INVALID, /**< Object is invalid. */ + GTObjectTypeCommit = GIT_OBJECT_COMMIT, /**< A commit object. */ + GTObjectTypeTree = GIT_OBJECT_TREE, /**< A tree (directory listing) object. */ + GTObjectTypeBlob = GIT_OBJECT_BLOB, /**< A file revision object. */ + GTObjectTypeTag = GIT_OBJECT_TAG, /**< An annotated tag object. */ + GTObjectTypeOffsetDelta = GIT_OBJECT_OFS_DELTA,/**< A delta, base is given by an offset. */ + GTObjectTypeRefDelta = GIT_OBJECT_REF_DELTA, /**< A delta, base is given by object id. */ }; @class GTRepository; diff --git a/ObjectiveGit/GTObject.m b/ObjectiveGit/GTObject.m index 46ae4ae0e..503585092 100644 --- a/ObjectiveGit/GTObject.m +++ b/ObjectiveGit/GTObject.m @@ -82,18 +82,18 @@ - (id)initWithObj:(git_object *)object inRepository:(GTRepository *)repo { NSAssert(object_repo == repo.git_repository, @"object %p doesn't belong to repo %@", object, repo); Class objectClass = nil; - git_otype t = git_object_type(object); + git_object_t t = git_object_type(object); switch (t) { - case GIT_OBJ_COMMIT: + case GIT_OBJECT_COMMIT: objectClass = [GTCommit class]; break; - case GIT_OBJ_TREE: + case GIT_OBJECT_TREE: objectClass = [GTTree class]; break; - case GIT_OBJ_BLOB: + case GIT_OBJECT_BLOB: objectClass = [GTBlob class]; break; - case GIT_OBJ_TAG: + case GIT_OBJECT_TAG: objectClass = [GTTag class]; break; default: @@ -101,7 +101,7 @@ - (id)initWithObj:(git_object *)object inRepository:(GTRepository *)repo { } if (!objectClass) { - NSLog(@"Unknown git_otype %s (%d)", git_object_type2string(t), (int)t); + NSLog(@"Unknown git_object_t %s (%d)", git_object_type2string(t), (int)t); return nil; } @@ -149,7 +149,7 @@ - (GTOdbObject *)odbObjectWithError:(NSError **)error { - (id)objectByPeelingToType:(GTObjectType)type error:(NSError **)error { git_object *peeled = NULL; - int gitError = git_object_peel(&peeled, self.git_object, (git_otype)type); + int gitError = git_object_peel(&peeled, self.git_object, (git_object_t)type); if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Cannot peel object"]; return nil; diff --git a/ObjectiveGit/GTObjectDatabase.m b/ObjectiveGit/GTObjectDatabase.m index 534df08da..99c431a48 100644 --- a/ObjectiveGit/GTObjectDatabase.m +++ b/ObjectiveGit/GTObjectDatabase.m @@ -102,7 +102,7 @@ - (GTOID *)writeData:(NSData *)data type:(GTObjectType)type error:(NSError **)er NSParameterAssert(data != nil); git_odb_stream *stream; - int gitError = git_odb_open_wstream(&stream, self.git_odb, data.length, (git_otype)type); + int gitError = git_odb_open_wstream(&stream, self.git_odb, data.length, (git_object_t)type); @onExit { if (stream != NULL) git_odb_stream_free(stream); }; diff --git a/ObjectiveGit/GTReference.h b/ObjectiveGit/GTReference.h index 786739fac..c24a9fc7b 100644 --- a/ObjectiveGit/GTReference.h +++ b/ObjectiveGit/GTReference.h @@ -34,9 +34,9 @@ typedef NS_ENUM(NSInteger, GTReferenceErrorCode) { }; typedef NS_OPTIONS(NSInteger, GTReferenceType) { - GTReferenceTypeInvalid = GIT_REF_INVALID, /** Invalid reference */ - GTReferenceTypeOid = GIT_REF_OID, /** A reference which points at an object id */ - GTReferenceTypeSymbolic = GIT_REF_SYMBOLIC, /** A reference which points at another reference */ + GTReferenceTypeInvalid = GIT_REFERENCE_INVALID, /** Invalid reference */ + GTReferenceTypeDirect = GIT_REFERENCE_DIRECT, /** A reference which points at an object id */ + GTReferenceTypeSymbolic = GIT_REFERENCE_SYMBOLIC, /** A reference which points at another reference */ }; NS_ASSUME_NONNULL_BEGIN diff --git a/ObjectiveGit/GTReference.m b/ObjectiveGit/GTReference.m index 2baacdacb..080375dd2 100644 --- a/ObjectiveGit/GTReference.m +++ b/ObjectiveGit/GTReference.m @@ -45,7 +45,7 @@ @interface GTReference () case GTReferenceTypeInvalid: return @"invalid"; - case GTReferenceTypeOid: + case GTReferenceTypeDirect: return @"direct"; case GTReferenceTypeSymbolic: @@ -144,7 +144,7 @@ - (GTReferenceType)referenceType { } - (id)unresolvedTarget { - if (self.referenceType == GTReferenceTypeOid) { + if (self.referenceType == GTReferenceTypeDirect) { const git_oid *oid = git_reference_target(self.git_reference); if (oid == NULL) return nil; @@ -160,7 +160,7 @@ - (id)unresolvedTarget { - (id)resolvedTarget { git_object *obj; - if (git_reference_peel(&obj, self.git_reference, GIT_OBJ_ANY) != GIT_OK) { + if (git_reference_peel(&obj, self.git_reference, GIT_OBJECT_ANY) != GIT_OK) { return nil; } @@ -181,7 +181,7 @@ - (GTReference *)referenceByUpdatingTarget:(NSString *)newTarget message:(NSStri int gitError; git_reference *newRef = NULL; - if (git_reference_type(self.git_reference) == GIT_REF_OID) { + if (git_reference_type(self.git_reference) == GIT_REFERENCE_DIRECT) { GTOID *oid = [[GTOID alloc] initWithSHA:newTarget error:error]; if (oid == nil) return nil; diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 851d81c28..133216cd4 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -317,7 +317,7 @@ + (instancetype _Nullable)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NS - (id)lookUpObjectByGitOid:(const git_oid *)oid objectType:(GTObjectType)type error:(NSError **)error { git_object *obj; - int gitError = git_object_lookup(&obj, self.git_repository, oid, (git_otype)type); + int gitError = git_object_lookup(&obj, self.git_repository, oid, (git_object_t)type); if (gitError < GIT_OK) { if (error != NULL) { char oid_str[GIT_OID_HEXSZ+1]; @@ -683,13 +683,13 @@ - (NSString *)preparedMessageWithError:(NSError * __autoreleasing *)error { int errorCode = git_repository_message(&msg, self.git_repository); if (errorCode != GIT_OK) { setErrorFromCode(errorCode); - git_buf_free(&msg); + git_buf_dispose(&msg); return nil; } NSString *message = [[NSString alloc] initWithBytes:msg.ptr length:msg.size encoding:NSUTF8StringEncoding]; - git_buf_free(&msg); + git_buf_dispose(&msg); return message; } diff --git a/ObjectiveGit/GTTreeBuilder.m b/ObjectiveGit/GTTreeBuilder.m index 5ae85646a..d53118e9d 100644 --- a/ObjectiveGit/GTTreeBuilder.m +++ b/ObjectiveGit/GTTreeBuilder.m @@ -155,7 +155,7 @@ - (GTTree *)writeTree:(NSError **)error { } git_object *object = NULL; - status = git_object_lookup(&object, self.repository.git_repository, &treeOid, GIT_OBJ_TREE); + status = git_object_lookup(&object, self.repository.git_repository, &treeOid, GIT_OBJECT_TREE); if (status != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:status description:@"Failed to lookup tree in repository."]; return nil; diff --git a/ObjectiveGitTests/GTReferenceSpec.m b/ObjectiveGitTests/GTReferenceSpec.m index 811a7e952..a3b9b4022 100644 --- a/ObjectiveGitTests/GTReferenceSpec.m +++ b/ObjectiveGitTests/GTReferenceSpec.m @@ -135,7 +135,7 @@ expect(ref).notTo(beNil()); expect(error).to(beNil()); - expectValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeOid, @"refs/heads/master"); + expectValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeDirect, @"refs/heads/master"); }); it(@"should return a valid reference to a tag", ^{ @@ -144,7 +144,7 @@ expect(ref).notTo(beNil()); expect(error).to(beNil()); - expectValidReference(ref, @"5b5b025afb0b4c913b4c338a42934a3863bf3644", GTReferenceTypeOid, @"refs/tags/v0.9"); + expectValidReference(ref, @"5b5b025afb0b4c913b4c338a42934a3863bf3644", GTReferenceTypeDirect, @"refs/tags/v0.9"); }); }); @@ -170,7 +170,7 @@ expect(error).to(beNil()); expect(ref).notTo(beNil()); - expectValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeOid, @"refs/heads/unit_test"); + expectValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeDirect, @"refs/heads/unit_test"); }); }); diff --git a/ObjectiveGitTests/GTRepositorySpec.m b/ObjectiveGitTests/GTRepositorySpec.m index 8da554cc8..2ff1aaf88 100644 --- a/ObjectiveGitTests/GTRepositorySpec.m +++ b/ObjectiveGitTests/GTRepositorySpec.m @@ -114,7 +114,7 @@ expect(head).notTo(beNil()); expect(error).to(beNil()); expect(head.targetOID.SHA).to(equal(@"36060c58702ed4c2a40832c51758d5344201d89a")); - expect(@(head.referenceType)).to(equal(@(GTReferenceTypeOid))); + expect(@(head.referenceType)).to(equal(@(GTReferenceTypeDirect))); }); it(@"should handle bare clones", ^{ @@ -139,7 +139,7 @@ expect(head).notTo(beNil()); expect(error).to(beNil()); expect(head.targetOID.SHA).to(equal(@"36060c58702ed4c2a40832c51758d5344201d89a")); - expect(@(head.referenceType)).to(equal(@(GTReferenceTypeOid))); + expect(@(head.referenceType)).to(equal(@(GTReferenceTypeDirect))); }); it(@"should have set a valid remote URL", ^{ @@ -212,7 +212,7 @@ expect(head).notTo(beNil()); expect(error).to(beNil()); expect(head.targetOID.SHA).to(equal(@"36060c58702ed4c2a40832c51758d5344201d89a")); - expect(@(head.referenceType)).to(equal(@(GTReferenceTypeOid))); + expect(@(head.referenceType)).to(equal(@(GTReferenceTypeDirect))); }); it(@"should fail to return HEAD for an unborn repo", ^{ From 22fd20baab7b9ea3e64801a76058e2d0f1fb8d21 Mon Sep 17 00:00:00 2001 From: Mingshen Sun Date: Fri, 22 Mar 2019 23:44:49 -0700 Subject: [PATCH 212/228] Update libssh2 to 1.8.1 --- External/libssh2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libssh2 b/External/libssh2 index 30e9c1347..f15b1e297 160000 --- a/External/libssh2 +++ b/External/libssh2 @@ -1 +1 @@ -Subproject commit 30e9c1347e3b8baa2951db612f05e6d87fc8e2f2 +Subproject commit f15b1e297f72882214988101ccdc5e6ad30d7e6e From d14f598582d6340de59ae6cfd95c73167c9d8062 Mon Sep 17 00:00:00 2001 From: David Catmull Date: Tue, 18 Jun 2019 15:30:38 -0600 Subject: [PATCH 213/228] Do Xcode's recommended localization naming updates --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 14 +++++++------- {English.lproj => en.lproj}/InfoPlist.strings | 0 2 files changed, 7 insertions(+), 7 deletions(-) rename {English.lproj => en.lproj}/InfoPlist.strings (100%) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 5043f44c4..3edf16bdf 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -452,7 +452,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 200578C418932A82001C06C3 /* GTBlameSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTBlameSpec.m; sourceTree = ""; }; 2089E43B17D9A58000F451DA /* GTTagSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTTagSpec.m; sourceTree = ""; }; @@ -592,6 +591,7 @@ BDFAF9C2131C1845000508BC /* GTIndex.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTIndex.m; sourceTree = ""; }; BDFAF9C7131C1868000508BC /* GTIndexEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTIndexEntry.h; sourceTree = ""; }; BDFAF9C8131C1868000508BC /* GTIndexEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = GTIndexEntry.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; + C9088CC322B98E8300DB4A02 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; D00F6815175D373C004DB9D6 /* GTReferenceSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTReferenceSpec.m; sourceTree = ""; }; D015F7C817F695E800AD5E1F /* GTRepository+Stashing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTRepository+Stashing.h"; sourceTree = ""; }; D015F7C917F695E800AD5E1F /* GTRepository+Stashing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+Stashing.m"; sourceTree = ""; }; @@ -1303,14 +1303,14 @@ }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ObjectiveGitFramework" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, en, + ja, + fr, + de, + Base, ); mainGroup = 0867D691FE84028FC02AAC07 /* ObjectiveGitFramework */; productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; @@ -1684,7 +1684,7 @@ 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 089C1667FE841158C02AAC07 /* English */, + C9088CC322B98E8300DB4A02 /* en */, ); name = InfoPlist.strings; sourceTree = ""; diff --git a/English.lproj/InfoPlist.strings b/en.lproj/InfoPlist.strings similarity index 100% rename from English.lproj/InfoPlist.strings rename to en.lproj/InfoPlist.strings From e9b4addb8e1b8675d9b9f346db5b37218e577805 Mon Sep 17 00:00:00 2001 From: Wil Shipley Date: Wed, 6 May 2020 04:46:39 -0700 Subject: [PATCH 214/228] Removed empty English.lproj/InfoPlist.strings from disk and from xcode project, because it throws warnings in latest Xcodes ('English' -> 'en') and does nothing useful. --- English.lproj/InfoPlist.strings | 2 -- ObjectiveGitFramework.xcodeproj/project.pbxproj | 15 --------------- 2 files changed, 17 deletions(-) delete mode 100644 English.lproj/InfoPlist.strings diff --git a/English.lproj/InfoPlist.strings b/English.lproj/InfoPlist.strings deleted file mode 100644 index 88f65cf6e..000000000 --- a/English.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 5043f44c4..ab5f82072 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -159,7 +159,6 @@ 88F6D9FA1320467100CC0BA8 /* GTCommit.h in Headers */ = {isa = PBXBuildFile; fileRef = BD6C22A41314609A00992935 /* GTCommit.h */; settings = {ATTRIBUTES = (Public, ); }; }; 88F6D9FB1320467500CC0BA8 /* GTObject.h in Headers */ = {isa = PBXBuildFile; fileRef = BD6C22A71314625800992935 /* GTObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; 88F6D9FC1320467800CC0BA8 /* GTSignature.h in Headers */ = {isa = PBXBuildFile; fileRef = BD6C254313148DC900992935 /* GTSignature.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; }; AA046112134F4D2000DF526B /* GTOdbObject.h in Headers */ = {isa = PBXBuildFile; fileRef = AA046110134F4D2000DF526B /* GTOdbObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; AA046114134F4D2000DF526B /* GTOdbObject.m in Sources */ = {isa = PBXBuildFile; fileRef = AA046111134F4D2000DF526B /* GTOdbObject.m */; }; @@ -452,7 +451,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 200578C418932A82001C06C3 /* GTBlameSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTBlameSpec.m; sourceTree = ""; }; 2089E43B17D9A58000F451DA /* GTTagSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTTagSpec.m; sourceTree = ""; }; @@ -777,7 +775,6 @@ isa = PBXGroup; children = ( 8DC2EF5A0486A6940098B216 /* Info.plist */, - 089C1666FE841158C02AAC07 /* InfoPlist.strings */, ); name = Resources; sourceTree = ""; @@ -1342,7 +1339,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1680,17 +1676,6 @@ }; /* End PBXTargetDependency section */ -/* Begin PBXVariantGroup section */ - 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 089C1667FE841158C02AAC07 /* English */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - /* Begin XCBuildConfiguration section */ 1DEB91AE08733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; From a1355f2808acf20584c800ba5ef45adc24413883 Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Thu, 28 Jan 2021 13:12:49 +0100 Subject: [PATCH 215/228] Recent brew list sysntax *** Updating submodules... *** Checking dependencies... Error: Calling `brew list` to only list formulae is disabled! Use `brew list --formula` instead. --- script/bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/bootstrap b/script/bootstrap index 18f76616a..aca53e814 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -62,7 +62,7 @@ check_deps () fi # Ensure that we have libgit2's dependencies installed. - installed=`brew list` + installed=`brew list --formula` for tool in $REQUIRED_TOOLS do From 028e3251a6e47588227be51dadfcc10695da74ed Mon Sep 17 00:00:00 2001 From: Adrien Vasseur Date: Wed, 14 Apr 2021 15:40:48 +0200 Subject: [PATCH 216/228] Fix packaging script when paths contain spaces --- script/repackage-dylibs.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/repackage-dylibs.rb b/script/repackage-dylibs.rb index f6b35a300..3af9ef430 100755 --- a/script/repackage-dylibs.rb +++ b/script/repackage-dylibs.rb @@ -45,7 +45,7 @@ def note(msg) TARGET_FRAMEWORKS_PATH = File.join(TARGET_BUILD_DIR, FRAMEWORKS_FOLDER_PATH) def extract_link_dependencies(executable) - deps = `otool -L #{executable}` + deps = `otool -L "#{executable}"` lines = deps.split("\n").map(&:strip) lines.shift @@ -92,7 +92,7 @@ def repackage_dependency(dep) FileUtils.cp dep[:path], TARGET_FRAMEWORKS_PATH FileUtils.chmod "u=rw", packaged_path - out = `install_name_tool -change #{dep.path} "@rpath/#{dep.name}" #{dep.executable}` + out = `install_name_tool -change "#{dep.path}" "@rpath/#{dep.name}" "#{dep.executable}"` if $? != 0 err "install_name_tool failed with error #{$?}:\n#{out}" end @@ -107,7 +107,7 @@ def repackage_dependency(dep) def fix_install_id(dep) note "Fixing #{dep.name} install_name id…" - out = `install_name_tool -id @rpath/#{dep.name} #{dep.executable}` + out = `install_name_tool -id "@rpath/#{dep.name}" "#{dep.executable}"` if $? != 0 err "install_name_tool failed with error #{$?}:\n#{out}" end From ecaa61ee01de1efc6708feb5e50b2d7747ea6764 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Wed, 10 Feb 2021 15:50:20 +0100 Subject: [PATCH 217/228] Yank most of .gitignore file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As project.xcworkspace was ignored, this makes it pretty hard to have a consistent environment between me and the rest of the world 😞. --- .gitignore | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.gitignore b/.gitignore index dc2f3d3ef..7ff5007c1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,16 +2,6 @@ *.swp *~.nib -build/* -.build/* -build-iPhoneSimulator/* -build-iPhoneOS/* -objective-git.bridgesupport -ObjectiveGitFramework/build/* -ObjectiveGit-iOS.framework/* -External/libgit2*.a -External/libgit2-ios - *.pbxuser *.perspective *.perspectivev3 @@ -19,16 +9,9 @@ External/libgit2-ios *.mode1v3 *.mode2v3 -project.xcworkspace */xcuserdata/ *.xccheckout *.xcscmblueprint -ObjectiveGitTests/fixtures/Fixtures/* - -External/ios-openssl/include -External/ios-openssl/lib -External/libssh2-ios - Carthage/Build From 750ad9e3021f58c1b357b1cd418c878282cb968b Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 7 May 2021 17:27:09 +0200 Subject: [PATCH 218/228] Remove leftover InfoPlist.strings reference --- Carthage/Checkouts/Nimble | 2 +- Carthage/Checkouts/ZipArchive | 2 +- Carthage/Checkouts/xcconfigs | 2 +- ObjectiveGitFramework.xcodeproj/project.pbxproj | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble index 9a281b1cf..e9d769113 160000 --- a/Carthage/Checkouts/Nimble +++ b/Carthage/Checkouts/Nimble @@ -1 +1 @@ -Subproject commit 9a281b1cfa1c53d1e8bd92e1798e4e473af8d263 +Subproject commit e9d769113660769a4d9dd3afb855562c0b7ae7b0 diff --git a/Carthage/Checkouts/ZipArchive b/Carthage/Checkouts/ZipArchive index e8b08ceb6..f3379e6ef 160000 --- a/Carthage/Checkouts/ZipArchive +++ b/Carthage/Checkouts/ZipArchive @@ -1 +1 @@ -Subproject commit e8b08ceb6ab9ff56e0826913b13680a129a92828 +Subproject commit f3379e6efa93e657293573ad196302b94041e464 diff --git a/Carthage/Checkouts/xcconfigs b/Carthage/Checkouts/xcconfigs index bb795558a..4ced0ad5a 160000 --- a/Carthage/Checkouts/xcconfigs +++ b/Carthage/Checkouts/xcconfigs @@ -1 +1 @@ -Subproject commit bb795558a76e5daf3688500055bbcfe243bffa8d +Subproject commit 4ced0ad5a971220917994a4edfa6abf9702e3818 diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 85d1cf442..8a57a4096 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -590,7 +590,6 @@ BDFAF9C2131C1845000508BC /* GTIndex.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTIndex.m; sourceTree = ""; }; BDFAF9C7131C1868000508BC /* GTIndexEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTIndexEntry.h; sourceTree = ""; }; BDFAF9C8131C1868000508BC /* GTIndexEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = GTIndexEntry.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - C9088CC322B98E8300DB4A02 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; D00F6815175D373C004DB9D6 /* GTReferenceSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTReferenceSpec.m; sourceTree = ""; }; D015F7C817F695E800AD5E1F /* GTRepository+Stashing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTRepository+Stashing.h"; sourceTree = ""; }; D015F7C917F695E800AD5E1F /* GTRepository+Stashing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+Stashing.m"; sourceTree = ""; }; From 168550209b015dda2e6e4aaff14ca2012f8742b6 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 7 May 2021 17:27:46 +0200 Subject: [PATCH 219/228] Bump project Swift version to 5 --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 8a57a4096..a7eecec1f 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -1766,7 +1766,7 @@ "$(inherited)", "-DGIT_SSH", ); - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( "$(inherited)", @@ -1804,7 +1804,7 @@ "$(inherited)", "-DGIT_SSH", ); - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( "$(inherited)", @@ -1883,7 +1883,6 @@ MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -1904,7 +1903,6 @@ MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; }; name = Release; }; @@ -1937,7 +1935,7 @@ "$(inherited)", "-DGIT_SSH", ); - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( "$(inherited)", @@ -1992,7 +1990,6 @@ MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; }; name = Test; }; @@ -2157,7 +2154,7 @@ "$(inherited)", "-DGIT_SSH", ); - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( "$(inherited)", @@ -2212,7 +2209,6 @@ MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; }; name = Profile; }; From 9f3724e55ccc43696881eb57a449bd1ff1b981ae Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 7 May 2021 17:45:27 +0200 Subject: [PATCH 220/228] Bump Carthage dependencies --- Cartfile.private | 6 +- Cartfile.resolved | 8 +-- Carthage/Checkouts/Nimble | 2 +- Carthage/Checkouts/Quick | 2 +- .../project.pbxproj | 65 +++++++++---------- 5 files changed, 41 insertions(+), 42 deletions(-) diff --git a/Cartfile.private b/Cartfile.private index 0dfa9b497..b021ce726 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,4 +1,4 @@ github "jspahrsummers/xcconfigs" "master" -github "Quick/Quick" ~> 1.3.4 -github "Quick/Nimble" ~> 7.3.3 -github "ZipArchive/ZipArchive" ~> 2.1.4 +github "Quick/Quick" ~> 2.1.0 +github "Quick/Nimble" ~> 8.0.1 +github "ZipArchive/ZipArchive" ~> 2.2.3 diff --git a/Cartfile.resolved b/Cartfile.resolved index 36c5288e0..1b6153da6 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ -github "Quick/Nimble" "v7.3.3" -github "Quick/Quick" "v1.3.4" -github "ZipArchive/ZipArchive" "v2.1.4" -github "jspahrsummers/xcconfigs" "bb795558a76e5daf3688500055bbcfe243bffa8d" +github "Quick/Nimble" "v8.1.2" +github "Quick/Quick" "v2.2.1" +github "ZipArchive/ZipArchive" "v2.2.3" +github "jspahrsummers/xcconfigs" "4ced0ad5a971220917994a4edfa6abf9702e3818" diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble index e9d769113..7a46a5fc8 160000 --- a/Carthage/Checkouts/Nimble +++ b/Carthage/Checkouts/Nimble @@ -1 +1 @@ -Subproject commit e9d769113660769a4d9dd3afb855562c0b7ae7b0 +Subproject commit 7a46a5fc86cb917f69e3daf79fcb045283d8f008 diff --git a/Carthage/Checkouts/Quick b/Carthage/Checkouts/Quick index f2b5a0644..09b3becb3 160000 --- a/Carthage/Checkouts/Quick +++ b/Carthage/Checkouts/Quick @@ -1 +1 @@ -Subproject commit f2b5a06440ea87eba1a167cab37bf6496646c52e +Subproject commit 09b3becb37cb2163919a3842a4c5fa6ec7130792 diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index a7eecec1f..4305d6920 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -490,6 +490,12 @@ 4D79C0ED17DF9F4D00997DE4 /* GTCredential.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTCredential.m; sourceTree = ""; }; 4D79C0F617DFAA7100997DE4 /* GTCredential+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTCredential+Private.h"; sourceTree = ""; }; 4D9BCD23206D84AD003CD3CE /* libgit2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgit2.a; path = External/build/lib/libgit2.a; sourceTree = ""; }; + 4DB97074264596AE00D14944 /* macOS-Application.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "macOS-Application.xcconfig"; sourceTree = ""; }; + 4DB97075264596AE00D14944 /* macOS-Framework.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "macOS-Framework.xcconfig"; sourceTree = ""; }; + 4DB97076264596AE00D14944 /* macOS-StaticLibrary.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "macOS-StaticLibrary.xcconfig"; sourceTree = ""; }; + 4DB97077264596AE00D14944 /* macOS-Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "macOS-Base.xcconfig"; sourceTree = ""; }; + 4DB97078264596AE00D14944 /* macOS-XCTest.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "macOS-XCTest.xcconfig"; sourceTree = ""; }; + 4DB97079264596AE00D14944 /* macOS-DynamicLibrary.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "macOS-DynamicLibrary.xcconfig"; sourceTree = ""; }; 4DBA4A3117DA73CE006CD5F5 /* GTRemoteSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTRemoteSpec.m; sourceTree = ""; }; 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTCheckoutOptions.h; sourceTree = ""; }; 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTCheckoutOptions.m; sourceTree = ""; }; @@ -626,11 +632,6 @@ D0D81863174421EB00995A2E /* iOS-Application.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "iOS-Application.xcconfig"; sourceTree = ""; }; D0D81864174421EB00995A2E /* iOS-Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "iOS-Base.xcconfig"; sourceTree = ""; }; D0D81865174421EB00995A2E /* iOS-StaticLibrary.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "iOS-StaticLibrary.xcconfig"; sourceTree = ""; }; - D0D81867174421EB00995A2E /* Mac-Application.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-Application.xcconfig"; sourceTree = ""; }; - D0D81868174421EB00995A2E /* Mac-Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-Base.xcconfig"; sourceTree = ""; }; - D0D81869174421EB00995A2E /* Mac-DynamicLibrary.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-DynamicLibrary.xcconfig"; sourceTree = ""; }; - D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-Framework.xcconfig"; sourceTree = ""; }; - D0D8186B174421EB00995A2E /* Mac-StaticLibrary.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-StaticLibrary.xcconfig"; sourceTree = ""; }; D0D8186C174421EB00995A2E /* README.md */ = {isa = PBXFileReference; lastKnownFileType = text; path = README.md; sourceTree = ""; }; D0F4E28917C7F24200BBDE30 /* NSErrorGitSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSErrorGitSpec.m; sourceTree = ""; }; DD3D9510182A81E1004AF532 /* GTBlame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTBlame.h; sourceTree = ""; }; @@ -639,7 +640,6 @@ DD3D951B182AB25C004AF532 /* GTBlameHunk.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTBlameHunk.m; sourceTree = ""; }; F81B6B51207B0A7700AB0836 /* Extension.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Extension.xcconfig; sourceTree = ""; }; F81B6B53207B0A8B00AB0836 /* iOS-Extension.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "iOS-Extension.xcconfig"; sourceTree = ""; }; - F81B6B54207B0A9F00AB0836 /* Mac-XCTest.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Mac-XCTest.xcconfig"; sourceTree = ""; }; F879D82F1B4B77F4002D5C07 /* Libgit2FeaturesSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Libgit2FeaturesSpec.m; sourceTree = ""; }; F879D8361B4B7F7C002D5C07 /* ObjectiveGit-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ObjectiveGit-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; F8D1BDEC1B31FE7C00CDEC90 /* GTRepository+Pull.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTRepository+Pull.h"; sourceTree = ""; }; @@ -819,6 +819,19 @@ name = "Other Sources"; sourceTree = ""; }; + 4DB97073264596AE00D14944 /* macOS */ = { + isa = PBXGroup; + children = ( + 4DB97074264596AE00D14944 /* macOS-Application.xcconfig */, + 4DB97075264596AE00D14944 /* macOS-Framework.xcconfig */, + 4DB97076264596AE00D14944 /* macOS-StaticLibrary.xcconfig */, + 4DB97077264596AE00D14944 /* macOS-Base.xcconfig */, + 4DB97078264596AE00D14944 /* macOS-XCTest.xcconfig */, + 4DB97079264596AE00D14944 /* macOS-DynamicLibrary.xcconfig */, + ); + path = macOS; + sourceTree = ""; + }; 88F05A7516011E5400B7AD1D /* ObjectiveGitTests */ = { isa = PBXGroup; children = ( @@ -1029,9 +1042,9 @@ D0D81857174421EB00995A2E /* Configuration */ = { isa = PBXGroup; children = ( + 4DB97073264596AE00D14944 /* macOS */, D0A463D517E57C45000F5021 /* Base */, D0D81862174421EB00995A2E /* iOS */, - D0D81866174421EB00995A2E /* Mac OS X */, D0D8186C174421EB00995A2E /* README.md */, ); name = Configuration; @@ -1050,19 +1063,6 @@ path = iOS; sourceTree = ""; }; - D0D81866174421EB00995A2E /* Mac OS X */ = { - isa = PBXGroup; - children = ( - D0D81867174421EB00995A2E /* Mac-Application.xcconfig */, - D0D81868174421EB00995A2E /* Mac-Base.xcconfig */, - D0D81869174421EB00995A2E /* Mac-DynamicLibrary.xcconfig */, - D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */, - D0D8186B174421EB00995A2E /* Mac-StaticLibrary.xcconfig */, - F81B6B54207B0A9F00AB0836 /* Mac-XCTest.xcconfig */, - ); - path = "Mac OS X"; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -1679,7 +1679,7 @@ /* Begin XCBuildConfiguration section */ 1DEB91AE08733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */; + baseConfigurationReference = 4DB97075264596AE00D14944 /* macOS-Framework.xcconfig */; buildSettings = { DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -1708,7 +1708,7 @@ }; 1DEB91AF08733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */; + baseConfigurationReference = 4DB97075264596AE00D14944 /* macOS-Framework.xcconfig */; buildSettings = { DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -1863,7 +1863,7 @@ }; 88F05A8016011E5400B7AD1D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = F81B6B54207B0A9F00AB0836 /* Mac-XCTest.xcconfig */; + baseConfigurationReference = 4DB97078264596AE00D14944 /* macOS-XCTest.xcconfig */; buildSettings = { CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -1880,7 +1880,6 @@ /usr/local/include, ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -1888,7 +1887,7 @@ }; 88F05A8116011E5400B7AD1D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D0D81867174421EB00995A2E /* Mac-Application.xcconfig */; + baseConfigurationReference = 4DB97078264596AE00D14944 /* macOS-XCTest.xcconfig */; buildSettings = { CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -1946,7 +1945,7 @@ }; D019778E19F830F500F523DA /* Test */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */; + baseConfigurationReference = 4DB97075264596AE00D14944 /* macOS-Framework.xcconfig */; buildSettings = { DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -1975,7 +1974,7 @@ }; D019778F19F830F500F523DA /* Test */ = { isa = XCBuildConfiguration; - baseConfigurationReference = F81B6B54207B0A9F00AB0836 /* Mac-XCTest.xcconfig */; + baseConfigurationReference = 4DB97078264596AE00D14944 /* macOS-XCTest.xcconfig */; buildSettings = { CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -2020,7 +2019,7 @@ }; D019779219F830F500F523DA /* Test */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D0D8186B174421EB00995A2E /* Mac-StaticLibrary.xcconfig */; + baseConfigurationReference = 4DB97076264596AE00D14944 /* macOS-StaticLibrary.xcconfig */; buildSettings = { PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2165,7 +2164,7 @@ }; D03FC3D81602E97F00BCFA73 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D0D8186A174421EB00995A2E /* Mac-Framework.xcconfig */; + baseConfigurationReference = 4DB97075264596AE00D14944 /* macOS-Framework.xcconfig */; buildSettings = { DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -2194,7 +2193,7 @@ }; D03FC3DA1602E97F00BCFA73 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D0D81867174421EB00995A2E /* Mac-Application.xcconfig */; + baseConfigurationReference = 4DB97078264596AE00D14944 /* macOS-XCTest.xcconfig */; buildSettings = { CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -2214,7 +2213,7 @@ }; D03FC3DB1602E97F00BCFA73 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D0D8186B174421EB00995A2E /* Mac-StaticLibrary.xcconfig */; + baseConfigurationReference = 4DB97076264596AE00D14944 /* macOS-StaticLibrary.xcconfig */; buildSettings = { PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2230,7 +2229,7 @@ }; D0A330EF16027F1E00A616FA /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D0D8186B174421EB00995A2E /* Mac-StaticLibrary.xcconfig */; + baseConfigurationReference = 4DB97076264596AE00D14944 /* macOS-StaticLibrary.xcconfig */; buildSettings = { PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2238,7 +2237,7 @@ }; D0A330F016027F1E00A616FA /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D0D8186B174421EB00995A2E /* Mac-StaticLibrary.xcconfig */; + baseConfigurationReference = 4DB97076264596AE00D14944 /* macOS-StaticLibrary.xcconfig */; buildSettings = { PRODUCT_NAME = "$(TARGET_NAME)"; }; From 63f389ece4633b5512e5989f365a52a504d6e04d Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 7 May 2021 17:45:57 +0200 Subject: [PATCH 221/228] Ensure OS deployment target is only set at project level --- ObjectiveGitFramework.xcodeproj/project.pbxproj | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 4305d6920..f88f1afe5 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -1760,7 +1760,7 @@ ., External, ); - MACOSX_DEPLOYMENT_TARGET = 10.8; + MACOSX_DEPLOYMENT_TARGET = 10.10; ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = ( "$(inherited)", @@ -1799,7 +1799,7 @@ ., External, ); - MACOSX_DEPLOYMENT_TARGET = 10.8; + MACOSX_DEPLOYMENT_TARGET = 10.10; OTHER_CFLAGS = ( "$(inherited)", "-DGIT_SSH", @@ -1899,7 +1899,6 @@ /usr/local/include, ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -1929,7 +1928,7 @@ ., External, ); - MACOSX_DEPLOYMENT_TARGET = 10.8; + MACOSX_DEPLOYMENT_TARGET = 10.10; OTHER_CFLAGS = ( "$(inherited)", "-DGIT_SSH", @@ -1986,7 +1985,6 @@ /usr/local/include, ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2148,7 +2146,7 @@ ., External, ); - MACOSX_DEPLOYMENT_TARGET = 10.8; + MACOSX_DEPLOYMENT_TARGET = 10.10; OTHER_CFLAGS = ( "$(inherited)", "-DGIT_SSH", @@ -2205,7 +2203,6 @@ /usr/local/include, ); INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; From f5cd655cd0b8b34377e682fce2fb2a993bffb30f Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 7 May 2021 19:01:10 +0200 Subject: [PATCH 222/228] Cleanup Carthage dependencies by recreating targets & schemes --- .../project.pbxproj | 569 +++++++++++++++++- .../contents.xcworkspacedata | 9 - 2 files changed, 539 insertions(+), 39 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index f88f1afe5..7b7b4db1a 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 52; objects = { /* Begin PBXAggregateTarget section */ @@ -93,12 +93,17 @@ 4D79C0EF17DF9F4D00997DE4 /* GTCredential.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D79C0ED17DF9F4D00997DE4 /* GTCredential.m */; }; 4D9BCD24206D84AD003CD3CE /* libgit2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D9BCD23206D84AD003CD3CE /* libgit2.a */; }; 4D9BCD25206D84B2003CD3CE /* libgit2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D9BCD23206D84AD003CD3CE /* libgit2.a */; }; + 4DB9711D2645CA3700D14944 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DB970A32645C8BB00D14944 /* Quick.framework */; }; + 4DB9711F2645CA5200D14944 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DB971172645C8F300D14944 /* ZipArchive.framework */; }; + 4DB971202645CA5D00D14944 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DB970AD2645C8BB00D14944 /* Quick.framework */; }; + 4DB971212645CA6600D14944 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DB971062645C8F300D14944 /* Nimble.framework */; }; + 4DB971222645CA6D00D14944 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DB971152645C8F300D14944 /* ZipArchive.framework */; }; 4DBA4A3217DA73CE006CD5F5 /* GTRemoteSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DBA4A3117DA73CE006CD5F5 /* GTRemoteSpec.m */; }; 4DC55AE51AD859AD0032563C /* GTCheckoutOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4DC55AE61AD859AD0032563C /* GTCheckoutOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4DC55AE71AD859AD0032563C /* GTCheckoutOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */; }; 4DC55AE81AD859AD0032563C /* GTCheckoutOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */; }; - 4DFA918F207D0B87003CD3CE /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63865207ACCAA00D1FD32 /* Nimble.framework */; }; + 4DD769A92645D214007599B8 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DB971022645C8F300D14944 /* Nimble.framework */; }; 4DFFB15B183AA8D600D1565E /* GTRepository+RemoteOperations.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DFFB159183AA8D600D1565E /* GTRepository+RemoteOperations.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4DFFB15C183AA8D600D1565E /* GTRepository+RemoteOperations.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DFFB15A183AA8D600D1565E /* GTRepository+RemoteOperations.m */; }; 55C8055013861FE7004DCB0F /* GTObjectDatabase.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C8054D13861F34004DCB0F /* GTObjectDatabase.m */; }; @@ -305,8 +310,6 @@ D09C2E361755F16200065E36 /* GTSubmodule.h in Headers */ = {isa = PBXBuildFile; fileRef = D09C2E341755F16200065E36 /* GTSubmodule.h */; settings = {ATTRIBUTES = (Public, ); }; }; D09C2E381755F16200065E36 /* GTSubmodule.m in Sources */ = {isa = PBXBuildFile; fileRef = D09C2E351755F16200065E36 /* GTSubmodule.m */; }; D09C2E51175602A500065E36 /* fixtures.zip in Resources */ = {isa = PBXBuildFile; fileRef = D09C2E50175602A500065E36 /* fixtures.zip */; }; - D0A0128A19F98475007F1914 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0A0128819F98475007F1914 /* Quick.framework */; }; - D0A0128C19F9853D007F1914 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0A0128B19F9853D007F1914 /* Nimble.framework */; }; D0A0129519F99EF8007F1914 /* NSDate+GTTimeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 30B1E7EC1703522100D0814D /* NSDate+GTTimeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; D0A0129719F9A660007F1914 /* SwiftSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0A0129619F9A660007F1914 /* SwiftSpec.swift */; }; D0AC906C172F941F00347DC4 /* GTRepositorySpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D0AC906B172F941F00347DC4 /* GTRepositorySpec.m */; }; @@ -368,9 +371,6 @@ F8D6385D207AC75100D1FD32 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BB67BB1C7DF45300A37A66 /* libz.tbd */; }; F8D6385F207ACAE600D1FD32 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D6385E207ACAE600D1FD32 /* libz.tbd */; }; F8D63861207ACAF700D1FD32 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63860207ACAF600D1FD32 /* libiconv.tbd */; }; - F8D63868207ACCEE00D1FD32 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63867207ACCEE00D1FD32 /* Quick.framework */; }; - F8D6386A207ACDDD00D1FD32 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63869207ACDDD00D1FD32 /* ZipArchive.framework */; }; - F8D6386C207ACE0600D1FD32 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D6386B207ACE0600D1FD32 /* ZipArchive.framework */; }; F8E4A2911A170CA6006485A8 /* GTRemotePushSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8E4A2901A170CA6006485A8 /* GTRemotePushSpec.m */; }; F8EFA03A1B4059ED000FF7D0 /* GTUtilityFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0391B4059ED000FF7D0 /* GTUtilityFunctions.m */; }; F964D5F11CE9D9B200F1D8DD /* GTNote.h in Headers */ = {isa = PBXBuildFile; fileRef = F964D5EF1CE9D9B200F1D8DD /* GTNote.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -388,6 +388,209 @@ remoteGlobalIDString = D0A330ED16027F1E00A616FA; remoteInfo = libgit2; }; + 4DB970A22645C8BB00D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970912645C8BA00D14944 /* Quick.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = DAEB6B8E1943873100289F44; + remoteInfo = "Quick-macOS"; + }; + 4DB970A42645C8BB00D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970912645C8BA00D14944 /* Quick.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = DAEB6B991943873100289F44; + remoteInfo = "Quick - macOSTests"; + }; + 4DB970A62645C8BB00D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970912645C8BA00D14944 /* Quick.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = CD89D17B247A673100C1F086; + remoteInfo = QuickIssue853RegressionTests; + }; + 4DB970A82645C8BB00D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970912645C8BA00D14944 /* Quick.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = DA5663E81A4C8D8500193C88; + remoteInfo = "QuickFocused - macOSTests"; + }; + 4DB970AA2645C8BB00D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970912645C8BA00D14944 /* Quick.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 64076CF51D6D7C2000E2B499; + remoteInfo = "QuickAfterSuite - macOSTests"; + }; + 4DB970AC2645C8BB00D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970912645C8BA00D14944 /* Quick.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 5A5D117C19473F2100F6D13D; + remoteInfo = "Quick-iOS"; + }; + 4DB970AE2645C8BB00D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970912645C8BA00D14944 /* Quick.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 5A5D118619473F2100F6D13D; + remoteInfo = "Quick - iOSTests"; + }; + 4DB970B02645C8BB00D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970912645C8BA00D14944 /* Quick.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = DA9876B21A4C70EB0004AA17; + remoteInfo = "QuickFocused - iOSTests"; + }; + 4DB970B22645C8BB00D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970912645C8BA00D14944 /* Quick.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 64076D081D6D7CD600E2B499; + remoteInfo = "QuickAfterSuite - iOSTests"; + }; + 4DB970B42645C8BB00D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970912645C8BA00D14944 /* Quick.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1F118CD51BDCA4AB005013A2; + remoteInfo = "Quick-tvOS"; + }; + 4DB970B62645C8BB00D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970912645C8BA00D14944 /* Quick.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1F118CDE1BDCA4AB005013A2; + remoteInfo = "Quick - tvOSTests"; + }; + 4DB970B82645C8BB00D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970912645C8BA00D14944 /* Quick.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1F118CF01BDCA4BB005013A2; + remoteInfo = "QuickFocused - tvOSTests"; + }; + 4DB970BA2645C8BB00D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970912645C8BA00D14944 /* Quick.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 64076D1A1D6D7CEA00E2B499; + remoteInfo = "QuickAfterSuite - tvOSTests"; + }; + 4DB971012645C8F300D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970F72645C8F300D14944 /* Nimble.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1F925EAD195C0D6300ED456B; + remoteInfo = "Nimble-macOS"; + }; + 4DB971032645C8F300D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970F72645C8F300D14944 /* Nimble.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1F925EB7195C0D6300ED456B; + remoteInfo = "Nimble-macOSTests"; + }; + 4DB971052645C8F300D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970F72645C8F300D14944 /* Nimble.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1F1A74291940169200FFFC47; + remoteInfo = "Nimble-iOS"; + }; + 4DB971072645C8F300D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970F72645C8F300D14944 /* Nimble.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1F1A74341940169200FFFC47; + remoteInfo = "Nimble-iOSTests"; + }; + 4DB971092645C8F300D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970F72645C8F300D14944 /* Nimble.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1F5DF1551BDCA0CE00C3A531; + remoteInfo = "Nimble-tvOS"; + }; + 4DB9710B2645C8F300D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970F72645C8F300D14944 /* Nimble.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1F5DF15E1BDCA0CE00C3A531; + remoteInfo = "Nimble-tvOSTests"; + }; + 4DB971142645C8F300D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB9710D2645C8F300D14944 /* ZipArchive.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = B423AE1A1C0DF76A0004A2F1; + remoteInfo = "ZipArchive-iOS"; + }; + 4DB971162645C8F300D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB9710D2645C8F300D14944 /* ZipArchive.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = AFF75A241C37279600F450AC; + remoteInfo = "ZipArchive-Mac"; + }; + 4DB971182645C8F300D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB9710D2645C8F300D14944 /* ZipArchive.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 37952C261F63B50D00DD6677; + remoteInfo = "ZipArchive-tvos"; + }; + 4DB9711A2645C8F300D14944 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB9710D2645C8F300D14944 /* ZipArchive.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 37952C5E1F63BB7100DD6677; + remoteInfo = "ZipArchive-watchos"; + }; + 4DD769842645D15D007599B8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970912645C8BA00D14944 /* Quick.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = DAEB6B8D1943873100289F44; + remoteInfo = "Quick-macOS"; + }; + 4DD769862645D15D007599B8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970F72645C8F300D14944 /* Nimble.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 1F925EAC195C0D6300ED456B; + remoteInfo = "Nimble-macOS"; + }; + 4DD769882645D15D007599B8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB9710D2645C8F300D14944 /* ZipArchive.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = AFF75A231C37279600F450AC; + remoteInfo = "ZipArchive-Mac"; + }; + 4DD769A32645D16B007599B8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970912645C8BA00D14944 /* Quick.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 5A5D117B19473F2100F6D13D; + remoteInfo = "Quick-iOS"; + }; + 4DD769A52645D16B007599B8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB970F72645C8F300D14944 /* Nimble.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 1F1A74281940169200FFFC47; + remoteInfo = "Nimble-iOS"; + }; + 4DD769A72645D16B007599B8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4DB9710D2645C8F300D14944 /* ZipArchive.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = B423AE191C0DF76A0004A2F1; + remoteInfo = "ZipArchive-iOS"; + }; 6A3C609C17D5964E00382DFF /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; @@ -496,6 +699,9 @@ 4DB97077264596AE00D14944 /* macOS-Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "macOS-Base.xcconfig"; sourceTree = ""; }; 4DB97078264596AE00D14944 /* macOS-XCTest.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "macOS-XCTest.xcconfig"; sourceTree = ""; }; 4DB97079264596AE00D14944 /* macOS-DynamicLibrary.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "macOS-DynamicLibrary.xcconfig"; sourceTree = ""; }; + 4DB970912645C8BA00D14944 /* Quick.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Quick.xcodeproj; path = Carthage/Checkouts/Quick/Quick.xcodeproj; sourceTree = ""; }; + 4DB970F72645C8F300D14944 /* Nimble.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Nimble.xcodeproj; path = Carthage/Checkouts/Nimble/Nimble.xcodeproj; sourceTree = ""; }; + 4DB9710D2645C8F300D14944 /* ZipArchive.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ZipArchive.xcodeproj; path = Carthage/Checkouts/ZipArchive/ZipArchive.xcodeproj; sourceTree = ""; }; 4DBA4A3117DA73CE006CD5F5 /* GTRemoteSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTRemoteSpec.m; sourceTree = ""; }; 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTCheckoutOptions.h; sourceTree = ""; }; 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTCheckoutOptions.m; sourceTree = ""; }; @@ -616,8 +822,6 @@ D09C2E341755F16200065E36 /* GTSubmodule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTSubmodule.h; sourceTree = ""; }; D09C2E351755F16200065E36 /* GTSubmodule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTSubmodule.m; sourceTree = ""; }; D09C2E50175602A500065E36 /* fixtures.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = fixtures.zip; path = fixtures/fixtures.zip; sourceTree = ""; }; - D0A0128819F98475007F1914 /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Quick.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - D0A0128B19F9853D007F1914 /* Nimble.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D0A0129619F9A660007F1914 /* SwiftSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftSpec.swift; sourceTree = ""; }; D0A463D617E57C45000F5021 /* Common.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Common.xcconfig; sourceTree = ""; }; D0A463D817E57C45000F5021 /* Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; @@ -648,10 +852,6 @@ F8D6385B207AC74A00D1FD32 /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = usr/lib/libiconv.tbd; sourceTree = SDKROOT; }; F8D6385E207ACAE600D1FD32 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; }; F8D63860207ACAF600D1FD32 /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/usr/lib/libiconv.tbd; sourceTree = DEVELOPER_DIR; }; - F8D63865207ACCAA00D1FD32 /* Nimble.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Nimble.framework; path = "../Debug-iphonesimulator/Nimble.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; - F8D63867207ACCEE00D1FD32 /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = "../Debug-iphonesimulator/Quick.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; - F8D63869207ACDDD00D1FD32 /* ZipArchive.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZipArchive.framework; path = "../Debug-iphonesimulator/ZipArchive.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; - F8D6386B207ACE0600D1FD32 /* ZipArchive.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ZipArchive.framework; sourceTree = BUILT_PRODUCTS_DIR; }; F8D63871207AE62A00D1FD32 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; F8D63872207AE63A00D1FD32 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; F8E4A2901A170CA6006485A8 /* GTRemotePushSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTRemotePushSpec.m; sourceTree = ""; }; @@ -669,10 +869,10 @@ buildActionMask = 2147483647; files = ( F81B6B50207B032800AB0836 /* XCTest.framework in Frameworks */, - D0A0128A19F98475007F1914 /* Quick.framework in Frameworks */, 88F05A9E16011F6E00B7AD1D /* ObjectiveGit.framework in Frameworks */, - D0A0128C19F9853D007F1914 /* Nimble.framework in Frameworks */, - F8D6386C207ACE0600D1FD32 /* ZipArchive.framework in Frameworks */, + 4DB9711D2645CA3700D14944 /* Quick.framework in Frameworks */, + 4DD769A92645D214007599B8 /* Nimble.framework in Frameworks */, + 4DB9711F2645CA5200D14944 /* ZipArchive.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -705,10 +905,10 @@ buildActionMask = 2147483647; files = ( F84277BE207B104A008AB8E8 /* XCTest.framework in Frameworks */, - F8D63868207ACCEE00D1FD32 /* Quick.framework in Frameworks */, F879D83C1B4B7F7D002D5C07 /* ObjectiveGit.framework in Frameworks */, - 4DFA918F207D0B87003CD3CE /* Nimble.framework in Frameworks */, - F8D6386A207ACDDD00D1FD32 /* ZipArchive.framework in Frameworks */, + 4DB971202645CA5D00D14944 /* Quick.framework in Frameworks */, + 4DB971212645CA6600D14944 /* Nimble.framework in Frameworks */, + 4DB971222645CA6D00D14944 /* ZipArchive.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -739,6 +939,7 @@ D0D81857174421EB00995A2E /* Configuration */, 034768DFFF38A50411DB9C8B /* Products */, F8D6384A207A618D00D1FD32 /* script */, + 4DB9711C2645CA3700D14944 /* Frameworks */, ); name = ObjectiveGitFramework; sourceTree = ""; @@ -747,6 +948,7 @@ 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { isa = PBXGroup; children = ( + 4DB970902645C8A500D14944 /* Carthage */, 306123A817EA5261006591D4 /* extobjc */, 889923F919FF5DD40092A9A6 /* git2 */, 6A1F2FD317C6A8F3003DFADE /* libcrypto.a */, @@ -758,15 +960,9 @@ 6A502B8617D6892D00BAF4A5 /* libssh2.a */, 4D9BCD23206D84AD003CD3CE /* libgit2.a */, 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, - D0A0128B19F9853D007F1914 /* Nimble.framework */, - F8D63865207ACCAA00D1FD32 /* Nimble.framework */, - D0A0128819F98475007F1914 /* Quick.framework */, - F8D63867207ACCEE00D1FD32 /* Quick.framework */, 887DAFF615CB1C8000F30D0D /* Security.framework */, F8D63871207AE62A00D1FD32 /* XCTest.framework */, F8D63872207AE63A00D1FD32 /* XCTest.framework */, - F8D6386B207ACE0600D1FD32 /* ZipArchive.framework */, - F8D63869207ACDDD00D1FD32 /* ZipArchive.framework */, ); name = "External Frameworks and Libraries"; sourceTree = ""; @@ -832,6 +1028,67 @@ path = macOS; sourceTree = ""; }; + 4DB970902645C8A500D14944 /* Carthage */ = { + isa = PBXGroup; + children = ( + 4DB970912645C8BA00D14944 /* Quick.xcodeproj */, + 4DB970F72645C8F300D14944 /* Nimble.xcodeproj */, + 4DB9710D2645C8F300D14944 /* ZipArchive.xcodeproj */, + ); + name = Carthage; + sourceTree = ""; + }; + 4DB970922645C8BA00D14944 /* Products */ = { + isa = PBXGroup; + children = ( + 4DB970A32645C8BB00D14944 /* Quick.framework */, + 4DB970A52645C8BB00D14944 /* Quick - macOSTests.xctest */, + 4DB970A72645C8BB00D14944 /* QuickIssue853RegressionTests.xctest */, + 4DB970A92645C8BB00D14944 /* QuickFocused - macOSTests.xctest */, + 4DB970AB2645C8BB00D14944 /* QuickAfterSuite - macOSTests.xctest */, + 4DB970AD2645C8BB00D14944 /* Quick.framework */, + 4DB970AF2645C8BB00D14944 /* Quick - iOSTests.xctest */, + 4DB970B12645C8BB00D14944 /* QuickFocused - iOSTests.xctest */, + 4DB970B32645C8BB00D14944 /* QuickAfterSuite - iOSTests.xctest */, + 4DB970B52645C8BB00D14944 /* Quick.framework */, + 4DB970B72645C8BB00D14944 /* Quick - tvOSTests.xctest */, + 4DB970B92645C8BB00D14944 /* QuickFocused - tvOSTests.xctest */, + 4DB970BB2645C8BB00D14944 /* QuickAfterSuite - tvOSTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 4DB970F82645C8F300D14944 /* Products */ = { + isa = PBXGroup; + children = ( + 4DB971022645C8F300D14944 /* Nimble.framework */, + 4DB971042645C8F300D14944 /* NimbleTests.xctest */, + 4DB971062645C8F300D14944 /* Nimble.framework */, + 4DB971082645C8F300D14944 /* NimbleTests.xctest */, + 4DB9710A2645C8F300D14944 /* Nimble.framework */, + 4DB9710C2645C8F300D14944 /* NimbleTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 4DB9710E2645C8F300D14944 /* Products */ = { + isa = PBXGroup; + children = ( + 4DB971152645C8F300D14944 /* ZipArchive.framework */, + 4DB971172645C8F300D14944 /* ZipArchive.framework */, + 4DB971192645C8F300D14944 /* ZipArchive.framework */, + 4DB9711B2645C8F300D14944 /* ZipArchive.framework */, + ); + name = Products; + sourceTree = ""; + }; + 4DB9711C2645CA3700D14944 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; 88F05A7516011E5400B7AD1D /* ObjectiveGitTests */ = { isa = PBXGroup; children = ( @@ -1205,6 +1462,9 @@ buildRules = ( ); dependencies = ( + 4DD769852645D15D007599B8 /* PBXTargetDependency */, + 4DD769872645D15D007599B8 /* PBXTargetDependency */, + 4DD769892645D15D007599B8 /* PBXTargetDependency */, 88F05AA016011F9000B7AD1D /* PBXTargetDependency */, ); name = "ObjectiveGit-MacTests"; @@ -1264,6 +1524,9 @@ buildRules = ( ); dependencies = ( + 4DD769A42645D16B007599B8 /* PBXTargetDependency */, + 4DD769A62645D16B007599B8 /* PBXTargetDependency */, + 4DD769A82645D16B007599B8 /* PBXTargetDependency */, F879D83E1B4B7F7D002D5C07 /* PBXTargetDependency */, ); name = "ObjectiveGit-iOSTests"; @@ -1312,6 +1575,20 @@ mainGroup = 0867D691FE84028FC02AAC07 /* ObjectiveGitFramework */; productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 4DB970F82645C8F300D14944 /* Products */; + ProjectRef = 4DB970F72645C8F300D14944 /* Nimble.xcodeproj */; + }, + { + ProductGroup = 4DB970922645C8BA00D14944 /* Products */; + ProjectRef = 4DB970912645C8BA00D14944 /* Quick.xcodeproj */; + }, + { + ProductGroup = 4DB9710E2645C8F300D14944 /* Products */; + ProjectRef = 4DB9710D2645C8F300D14944 /* ZipArchive.xcodeproj */; + }, + ); projectRoot = ""; targets = ( 8DC2EF4F0486A6940098B216 /* ObjectiveGit-Mac */, @@ -1326,6 +1603,170 @@ }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + 4DB970A32645C8BB00D14944 /* Quick.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = Quick.framework; + remoteRef = 4DB970A22645C8BB00D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB970A52645C8BB00D14944 /* Quick - macOSTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "Quick - macOSTests.xctest"; + remoteRef = 4DB970A42645C8BB00D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB970A72645C8BB00D14944 /* QuickIssue853RegressionTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = QuickIssue853RegressionTests.xctest; + remoteRef = 4DB970A62645C8BB00D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB970A92645C8BB00D14944 /* QuickFocused - macOSTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "QuickFocused - macOSTests.xctest"; + remoteRef = 4DB970A82645C8BB00D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB970AB2645C8BB00D14944 /* QuickAfterSuite - macOSTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "QuickAfterSuite - macOSTests.xctest"; + remoteRef = 4DB970AA2645C8BB00D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB970AD2645C8BB00D14944 /* Quick.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = Quick.framework; + remoteRef = 4DB970AC2645C8BB00D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB970AF2645C8BB00D14944 /* Quick - iOSTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "Quick - iOSTests.xctest"; + remoteRef = 4DB970AE2645C8BB00D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB970B12645C8BB00D14944 /* QuickFocused - iOSTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "QuickFocused - iOSTests.xctest"; + remoteRef = 4DB970B02645C8BB00D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB970B32645C8BB00D14944 /* QuickAfterSuite - iOSTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "QuickAfterSuite - iOSTests.xctest"; + remoteRef = 4DB970B22645C8BB00D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB970B52645C8BB00D14944 /* Quick.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = Quick.framework; + remoteRef = 4DB970B42645C8BB00D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB970B72645C8BB00D14944 /* Quick - tvOSTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "Quick - tvOSTests.xctest"; + remoteRef = 4DB970B62645C8BB00D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB970B92645C8BB00D14944 /* QuickFocused - tvOSTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "QuickFocused - tvOSTests.xctest"; + remoteRef = 4DB970B82645C8BB00D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB970BB2645C8BB00D14944 /* QuickAfterSuite - tvOSTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "QuickAfterSuite - tvOSTests.xctest"; + remoteRef = 4DB970BA2645C8BB00D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB971022645C8F300D14944 /* Nimble.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = Nimble.framework; + remoteRef = 4DB971012645C8F300D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB971042645C8F300D14944 /* NimbleTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = NimbleTests.xctest; + remoteRef = 4DB971032645C8F300D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB971062645C8F300D14944 /* Nimble.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = Nimble.framework; + remoteRef = 4DB971052645C8F300D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB971082645C8F300D14944 /* NimbleTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = NimbleTests.xctest; + remoteRef = 4DB971072645C8F300D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB9710A2645C8F300D14944 /* Nimble.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = Nimble.framework; + remoteRef = 4DB971092645C8F300D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB9710C2645C8F300D14944 /* NimbleTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = NimbleTests.xctest; + remoteRef = 4DB9710B2645C8F300D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB971152645C8F300D14944 /* ZipArchive.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = ZipArchive.framework; + remoteRef = 4DB971142645C8F300D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB971172645C8F300D14944 /* ZipArchive.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = ZipArchive.framework; + remoteRef = 4DB971162645C8F300D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB971192645C8F300D14944 /* ZipArchive.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = ZipArchive.framework; + remoteRef = 4DB971182645C8F300D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4DB9711B2645C8F300D14944 /* ZipArchive.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = ZipArchive.framework; + remoteRef = 4DB9711A2645C8F300D14944 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXResourcesBuildPhase section */ 88F05A6816011E5400B7AD1D /* Resources */ = { isa = PBXResourcesBuildPhase; @@ -1649,6 +2090,36 @@ target = D0A330ED16027F1E00A616FA /* libgit2 */; targetProxy = 3D6123BD1A6432F6008F831A /* PBXContainerItemProxy */; }; + 4DD769852645D15D007599B8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "Quick-macOS"; + targetProxy = 4DD769842645D15D007599B8 /* PBXContainerItemProxy */; + }; + 4DD769872645D15D007599B8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "Nimble-macOS"; + targetProxy = 4DD769862645D15D007599B8 /* PBXContainerItemProxy */; + }; + 4DD769892645D15D007599B8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "ZipArchive-Mac"; + targetProxy = 4DD769882645D15D007599B8 /* PBXContainerItemProxy */; + }; + 4DD769A42645D16B007599B8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "Quick-iOS"; + targetProxy = 4DD769A32645D16B007599B8 /* PBXContainerItemProxy */; + }; + 4DD769A62645D16B007599B8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "Nimble-iOS"; + targetProxy = 4DD769A52645D16B007599B8 /* PBXContainerItemProxy */; + }; + 4DD769A82645D16B007599B8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "ZipArchive-iOS"; + targetProxy = 4DD769A72645D16B007599B8 /* PBXContainerItemProxy */; + }; 6A3C609D17D5964E00382DFF /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 6A28265217C69CB400C6A948 /* OpenSSL-iOS */; @@ -1666,6 +2137,7 @@ }; D019779719F8335100F523DA /* PBXTargetDependency */ = { isa = PBXTargetDependency; + platformFilter = ios; target = D0A330F216027F3600A616FA /* libgit2-iOS */; targetProxy = D019779619F8335100F523DA /* PBXContainerItemProxy */; }; @@ -1869,6 +2341,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(PROJECT_DIR)/Carthage/Build/Mac", ); GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -1893,6 +2366,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(PROJECT_DIR)/Carthage/Build/Mac", ); HEADER_SEARCH_PATHS = ( External/libgit2/include, @@ -1979,6 +2453,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(PROJECT_DIR)/Carthage/Build/Mac", ); HEADER_SEARCH_PATHS = ( External/libgit2/include, @@ -2197,6 +2672,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(PROJECT_DIR)/Carthage/Build/Mac", ); HEADER_SEARCH_PATHS = ( External/libgit2/include, @@ -2275,6 +2751,10 @@ COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -2296,7 +2776,11 @@ GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( ., External, @@ -2328,6 +2812,10 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -2340,7 +2828,11 @@ GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( ., External, @@ -2373,6 +2865,10 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -2385,7 +2881,11 @@ GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( ., External, @@ -2394,7 +2894,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; VALIDATE_PRODUCT = YES; }; name = Release; @@ -2419,6 +2920,10 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -2431,7 +2936,11 @@ GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( ., External, diff --git a/ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata b/ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata index d37216e50..e759ae56c 100644 --- a/ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata +++ b/ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata @@ -7,13 +7,4 @@ - - - - - - From 833a200e28dee325fe38780a1a994324b20cf07b Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Wed, 10 Feb 2021 15:10:05 +0100 Subject: [PATCH 223/228] Rename macOS libgit.a to stop Xcode from choosing wrong --- .gitignore | 1 + .../project.pbxproj | 22 ++++++++++--------- script/update_libgit2 | 8 +++---- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 7ff5007c1..7caa37186 100644 --- a/.gitignore +++ b/.gitignore @@ -13,5 +13,6 @@ *.xccheckout *.xcscmblueprint +External/libgit2-mac.a Carthage/Build diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 7b7b4db1a..26da37c95 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -91,7 +91,6 @@ 4D1C40D8182C006D00BE2960 /* GTBlobSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D1C40D7182C006D00BE2960 /* GTBlobSpec.m */; }; 4D79C0EE17DF9F4D00997DE4 /* GTCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D79C0EC17DF9F4D00997DE4 /* GTCredential.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4D79C0EF17DF9F4D00997DE4 /* GTCredential.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D79C0ED17DF9F4D00997DE4 /* GTCredential.m */; }; - 4D9BCD24206D84AD003CD3CE /* libgit2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D9BCD23206D84AD003CD3CE /* libgit2.a */; }; 4D9BCD25206D84B2003CD3CE /* libgit2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D9BCD23206D84AD003CD3CE /* libgit2.a */; }; 4DB9711D2645CA3700D14944 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DB970A32645C8BB00D14944 /* Quick.framework */; }; 4DB9711F2645CA5200D14944 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DB971172645C8F300D14944 /* ZipArchive.framework */; }; @@ -104,6 +103,7 @@ 4DC55AE71AD859AD0032563C /* GTCheckoutOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */; }; 4DC55AE81AD859AD0032563C /* GTCheckoutOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */; }; 4DD769A92645D214007599B8 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DB971022645C8F300D14944 /* Nimble.framework */; }; + 4DD7422C25D3F8CB009D9A17 /* libgit2-mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DD7422B25D3F8CB009D9A17 /* libgit2-mac.a */; }; 4DFFB15B183AA8D600D1565E /* GTRepository+RemoteOperations.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DFFB159183AA8D600D1565E /* GTRepository+RemoteOperations.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4DFFB15C183AA8D600D1565E /* GTRepository+RemoteOperations.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DFFB15A183AA8D600D1565E /* GTRepository+RemoteOperations.m */; }; 55C8055013861FE7004DCB0F /* GTObjectDatabase.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C8054D13861F34004DCB0F /* GTObjectDatabase.m */; }; @@ -705,6 +705,7 @@ 4DBA4A3117DA73CE006CD5F5 /* GTRemoteSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTRemoteSpec.m; sourceTree = ""; }; 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTCheckoutOptions.h; sourceTree = ""; }; 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTCheckoutOptions.m; sourceTree = ""; }; + 4DD7422B25D3F8CB009D9A17 /* libgit2-mac.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libgit2-mac.a"; path = "External/libgit2-mac.a"; sourceTree = ""; }; 4DE864341794A37E00371A65 /* GTRepository+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTRepository+Private.h"; sourceTree = ""; }; 4DFFB159183AA8D600D1565E /* GTRepository+RemoteOperations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTRepository+RemoteOperations.h"; sourceTree = ""; }; 4DFFB15A183AA8D600D1565E /* GTRepository+RemoteOperations.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+RemoteOperations.m"; sourceTree = ""; }; @@ -882,7 +883,7 @@ files = ( F8D6385D207AC75100D1FD32 /* libz.tbd in Frameworks */, F8D6385C207AC74A00D1FD32 /* libiconv.tbd in Frameworks */, - 4D9BCD24206D84AD003CD3CE /* libgit2.a in Frameworks */, + 4DD7422C25D3F8CB009D9A17 /* libgit2-mac.a in Frameworks */, 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -959,6 +960,7 @@ 6A1F2FD417C6A8F3003DFADE /* libssl.a */, 6A502B8617D6892D00BAF4A5 /* libssh2.a */, 4D9BCD23206D84AD003CD3CE /* libgit2.a */, + 4DD7422B25D3F8CB009D9A17 /* libgit2-mac.a */, 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, 887DAFF615CB1C8000F30D0D /* Security.framework */, F8D63871207AE62A00D1FD32 /* XCTest.framework */, @@ -2161,12 +2163,12 @@ "$(inherited)", /usr/local/opt/openssl/lib, "$(PROJECT_DIR)/External/build/lib", + "$(PROJECT_DIR)/External", ); MODULEMAP_FILE = ObjectiveGit.modulemap; OTHER_LDFLAGS = ( - "-lgit2", "-force_load", - External/libgit2.a, + "External/libgit2-mac.a", /usr/local/lib/libssh2.a, "-lcrypto", "-lssl", @@ -2190,12 +2192,12 @@ "$(inherited)", /usr/local/opt/openssl/lib, "$(PROJECT_DIR)/External/build/lib", + "$(PROJECT_DIR)/External", ); MODULEMAP_FILE = ObjectiveGit.modulemap; OTHER_LDFLAGS = ( - "-lgit2", "-force_load", - External/libgit2.a, + "External/libgit2-mac.a", /usr/local/lib/libssh2.a, "-lcrypto", "-lssl", @@ -2428,12 +2430,12 @@ "$(inherited)", /usr/local/opt/openssl/lib, "$(PROJECT_DIR)/External/build/lib", + "$(PROJECT_DIR)/External", ); MODULEMAP_FILE = ObjectiveGit.modulemap; OTHER_LDFLAGS = ( - "-lgit2", "-force_load", - External/libgit2.a, + "External/libgit2-mac.a", /usr/local/lib/libssh2.a, "-lcrypto", "-lssl", @@ -2647,12 +2649,12 @@ "$(inherited)", /usr/local/opt/openssl/lib, "$(PROJECT_DIR)/External/build/lib", + "$(PROJECT_DIR)/External", ); MODULEMAP_FILE = ObjectiveGit.modulemap; OTHER_LDFLAGS = ( - "-lgit2", "-force_load", - External/libgit2.a, + "External/libgit2-mac.a", /usr/local/lib/libssh2.a, "-lcrypto", "-lssl", diff --git a/script/update_libgit2 b/script/update_libgit2 index 151231742..2c89cec38 100755 --- a/script/update_libgit2 +++ b/script/update_libgit2 @@ -7,7 +7,7 @@ set -e # ~/.MacOSX/environment.plist PATH="/usr/local/bin:$PATH" -if [ "External/libgit2.a" -nt "External/libgit2" ] +if [ "External/libgit2-mac.a" -nt "External/libgit2" ] then echo "No update needed." exit 0 @@ -33,9 +33,9 @@ cmake -DBUILD_SHARED_LIBS:BOOL=OFF \ cmake --build . product="libgit2.a" -install_path="../../${product}" -if [ "${product}" -nt "${install_path}" ]; then - cp -v "${product}" "${install_path}" +install_path="../../" +if [ "libgit2.a" -nt "${install_path}/libgit2-mac.a" ]; then + cp -v "libgit2.a" "${install_path}/libgit2-mac.a" fi echo "libgit2 has been updated." From 7399dea20b14313e114710e6438bd1c183b34e25 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 7 May 2021 19:07:06 +0200 Subject: [PATCH 224/228] Add missing bits from the workspace --- .../project.xcworkspace/contents.xcworkspacedata | 7 +++++++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ .../xcshareddata/WorkspaceSettings.xcsettings | 5 +++++ 3 files changed, 20 insertions(+) create mode 100644 ObjectiveGitFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 ObjectiveGitFramework.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 ObjectiveGitFramework.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/ObjectiveGitFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ObjectiveGitFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..f3c74e883 --- /dev/null +++ b/ObjectiveGitFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ObjectiveGitFramework.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ObjectiveGitFramework.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/ObjectiveGitFramework.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ObjectiveGitFramework.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ObjectiveGitFramework.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..0c67376eb --- /dev/null +++ b/ObjectiveGitFramework.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,5 @@ + + + + + From d577e45af205da5da8777a2f990614a1945156d8 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Thu, 28 Mar 2019 00:14:50 +0100 Subject: [PATCH 225/228] Bump Travis to Xcode 12.2 --- .travis.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4cab7cf69..52c7d6dcc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,17 +7,15 @@ # --- os: osx -osx_image: xcode9.3 +osx_image: xcode12.2 language: objective-c matrix: fast_finish: true include: - - osx_image: xcode9.3 - env: + - env: - SCHEME="ObjectiveGit Mac" - - osx_image: xcode9.3 - env: + - env: - SCHEME="ObjectiveGit iOS" before_install: From 5dbebb900c8d830c20c71da7a163a9f1f4425d9b Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 7 May 2021 19:42:38 +0200 Subject: [PATCH 226/228] Disable xcpretty --- script/cibuild | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/cibuild b/script/cibuild index cc58cb660..0d87df70b 100755 --- a/script/cibuild +++ b/script/cibuild @@ -59,7 +59,7 @@ if [ "$SCHEME" == "ObjectiveGit Mac" ]; then -scheme "$SCHEME" \ ${XCODE_OPTIONS[*]} \ build test \ - 2>&1 | xcpretty $XCPRETTY_FORMAT_OPTIONS + 2>&1 #| xcpretty $XCPRETTY_FORMAT_OPTIONS elif [ "$SCHEME" == "ObjectiveGit iOS" ]; then echo "*** Prebuilding OpenSSL" "$SCRIPT_DIR/update_libssl_ios" @@ -73,5 +73,5 @@ elif [ "$SCHEME" == "ObjectiveGit iOS" ]; then -sdk iphonesimulator \ ${XCODE_OPTIONS[*]} \ build test \ - 2>&1 | xcpretty $XCPRETTY_FORMAT_OPTIONS + 2>&1 #| xcpretty $XCPRETTY_FORMAT_OPTIONS fi From a4fcd238f1cb6ed7a3328a225ed8c5b37e462965 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 7 May 2021 19:43:10 +0200 Subject: [PATCH 227/228] Xcode being Xcode --- .../xcschemes/ObjectiveGit Mac.xcscheme | 22 ++++++++----------- .../xcschemes/ObjectiveGit iOS.xcscheme | 22 ++++++++----------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme b/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme index 2e7f2c268..02ffc2cf1 100644 --- a/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme +++ b/ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit Mac.xcscheme @@ -83,6 +83,15 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + + + @@ -95,17 +104,6 @@ - - - - - - - - + + + + @@ -81,17 +90,6 @@ - - - - - - - - Date: Fri, 7 May 2021 20:19:40 +0200 Subject: [PATCH 228/228] Use an available iOS destination --- script/cibuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/cibuild b/script/cibuild index 0d87df70b..0897947e5 100755 --- a/script/cibuild +++ b/script/cibuild @@ -69,7 +69,7 @@ elif [ "$SCHEME" == "ObjectiveGit iOS" ]; then xcodebuild -workspace "$XCWORKSPACE" \ -scheme "$SCHEME" \ - -destination "platform=iOS Simulator,name=iPhone 5" \ + -destination "platform=iOS Simulator,name=iPhone 11" \ -sdk iphonesimulator \ ${XCODE_OPTIONS[*]} \ build test \