Skip to content

Commit

Permalink
Merge branch 'master' into xcode-7
Browse files Browse the repository at this point in the history
  • Loading branch information
joshaber committed Oct 23, 2015
2 parents 49fd504 + 9219175 commit 4a6fd2d
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 43 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
@@ -1,6 +1,9 @@
osx_image: xcode7
language: objective-c
install: script/bootstrap
before_install: brew update
install:
- brew uninstall xctool && brew install --HEAD xctool
- script/bootstrap
script: script/cibuild
notifications:
email: false
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Quick
2 changes: 1 addition & 1 deletion ObjectiveGit/GTBlame.h
Expand Up @@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable instancetype)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;
@property (nonatomic, strong, readonly) NSArray<GTBlameHunk *> *hunks;

/// The number of hunks in the blame.
@property (nonatomic, readonly) NSUInteger hunkCount;
Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/GTBranch.h
Expand Up @@ -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;
- (nullable NSArray<GTCommit *> *)uniqueCommitsRelativeToBranch:(GTBranch *)otherBranch error:(NSError **)error;

/// Deletes the local branch and nils out the reference.
- (BOOL)deleteWithError:(NSError **)error;
Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/GTCommit.h
Expand Up @@ -40,7 +40,7 @@ NS_ASSUME_NONNULL_BEGIN

@property (nonatomic, readonly, strong, nullable) GTSignature *author;
@property (nonatomic, readonly, strong, nullable) GTSignature *committer;
@property (nonatomic, readonly, copy) NSArray *parents;
@property (nonatomic, readonly, copy) NSArray<GTCommit *> *parents;
@property (nonatomic, readonly, nullable) NSString *message;
@property (nonatomic, readonly) NSString *messageDetails;
@property (nonatomic, readonly) NSString *messageSummary;
Expand Down
5 changes: 3 additions & 2 deletions ObjectiveGit/GTConfiguration.h
Expand Up @@ -9,6 +9,7 @@
#import <Foundation/Foundation.h>
#import "git2/types.h"

@class GTRemote;
@class GTRepository;
@class GTSignature;

Expand All @@ -17,11 +18,11 @@ NS_ASSUME_NONNULL_BEGIN
@interface GTConfiguration : NSObject

@property (nonatomic, readonly, strong, nullable) GTRepository *repository;
@property (nonatomic, readonly, copy) NSArray *configurationKeys;
@property (nonatomic, readonly, copy) NSArray<NSString *> *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, nullable) NSArray<GTRemote *> *remotes;

- (instancetype)init NS_UNAVAILABLE;

Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/GTEnumerator.h
Expand Up @@ -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;
- (nullable NSArray<GTCommit *> *)allObjectsWithError:(NSError **)error;

/// Gets the next commit.
///
Expand Down
4 changes: 2 additions & 2 deletions ObjectiveGit/GTIndex.h
Expand Up @@ -49,7 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly) NSUInteger entryCount;

/// The GTIndexEntries in the index.
@property (nonatomic, readonly, copy) NSArray *entries;
@property (nonatomic, readonly, copy) NSArray<GTIndexEntry *> *entries;

/// Whether the index contains conflicted files.
@property (nonatomic, readonly) BOOL hasConflicts;
Expand Down Expand Up @@ -220,7 +220,7 @@ 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:(nullable NSArray<NSString*> *)pathspecs error:(NSError **)error passingTest:(nullable BOOL (^)(NSString *matchedPathspec, NSString *path, BOOL *stop))block;

#pragma mark Deprecations
- (nullable GTIndexEntry *)entryWithName:(NSString *)name __deprecated_msg("use entryWithPath: instead.");
Expand Down
4 changes: 2 additions & 2 deletions ObjectiveGit/GTRemote.h
Expand Up @@ -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, nullable) NSArray<NSString *> *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, nullable) NSArray<NSString *> *pushRefspecs;

/// Tests if a name is valid
+ (BOOL)isValidRemoteName:(NSString *)name;
Expand Down
4 changes: 2 additions & 2 deletions ObjectiveGit/GTRepository+Committing.h
Expand Up @@ -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;
- (nullable GTCommit *)createCommitWithTree:(GTTree *)tree message:(NSString *)message author:(GTSignature *)author committer:(GTSignature *)committer parents:(nullable NSArray<GTCommit *> *)parents updatingReferenceNamed:(nullable NSString *)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;
- (nullable GTCommit *)createCommitWithTree:(GTTree *)tree message:(NSString *)message parents:(nullable NSArray<GTCommit *> *)parents updatingReferenceNamed:(nullable NSString *)refName error:(NSError **)error;

@end

Expand Down
4 changes: 2 additions & 2 deletions ObjectiveGit/GTRepository+RemoteOperations.h
Expand Up @@ -48,7 +48,7 @@ extern NSString *const GTRepositoryRemoteOptionsCredentialProvider;
/// error - The error if one ocurred. Can be NULL.
///
/// Retruns a (possibly empty) array with GTFetchHeadEntry objects. Will not be nil.
- (NSArray *)fetchHeadEntriesWithError:(NSError **)error;
- (NSArray<GTFetchHeadEntry *> *)fetchHeadEntriesWithError:(NSError **)error;

#pragma mark - Push

Expand Down Expand Up @@ -78,7 +78,7 @@ extern NSString *const GTRepositoryRemoteOptionsCredentialProvider;
///
/// 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<GTBranch *> *)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;

/// Delete a remote branch
///
Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/GTRepository+Reset.h
Expand Up @@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
/// error - The error if one occurred.
///
/// Returns whether the reset was successful.
- (BOOL)resetPathspecs:(NSArray *)pathspecs toCommit:(GTCommit *)commit error:(NSError **)error;
- (BOOL)resetPathspecs:(NSArray<NSString *> *)pathspecs toCommit:(GTCommit *)commit error:(NSError **)error;

@end

Expand Down
16 changes: 8 additions & 8 deletions ObjectiveGit/GTRepository.h
Expand Up @@ -260,7 +260,7 @@ extern NSString * const GTRepositoryInitOptionsOriginURLString;
///
/// 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;
- (nullable NSArray<NSString *> *)referenceNamesWithError:(NSError **)error;

/// Get the HEAD reference.
///
Expand All @@ -274,44 +274,44 @@ extern NSString * const GTRepositoryInitOptionsOriginURLString;
/// 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;
- (nullable NSArray<GTBranch *> *)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;
- (nullable NSArray<GTBranch *> *)remoteBranchesWithError:(NSError **)error;

/// Get branches with names sharing a given prefix.
///
/// prefix - The prefix to use for filtering. Must not be nil.
/// 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;
- (nullable NSArray<GTBranch *> *)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.
///
/// 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;
- (nullable NSArray<GTBranch *> *)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;
- (nullable NSArray<NSString *> *)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;
- (nullable NSArray<GTTag *> *)allTagsWithError:(NSError **)error;

/// Count all commits in the current branch (HEAD)
///
Expand Down Expand Up @@ -367,7 +367,7 @@ extern NSString * const GTRepositoryInitOptionsOriginURLString;
/// 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;
- (nullable NSArray<GTCommit *> *)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.
Expand Down
15 changes: 0 additions & 15 deletions ObjectiveGit/GTRepository.m
Expand Up @@ -111,21 +111,6 @@ - (void)dealloc {

#pragma mark API

+ (BOOL)isAGitDirectory:(NSURL *)directory {
NSFileManager *fm = [[NSFileManager alloc] init];
BOOL isDir = NO;
NSURL *headFileURL = [directory URLByAppendingPathComponent:@"HEAD"];

if ([fm fileExistsAtPath:headFileURL.path isDirectory:&isDir] && !isDir) {
NSURL *objectsDir = [directory URLByAppendingPathComponent:@"objects"];
if ([fm fileExistsAtPath:objectsDir.path isDirectory:&isDir] && isDir) {
return YES;
}
}

return NO;
}

+ (instancetype)initializeEmptyRepositoryAtFileURL:(NSURL *)localFileURL options:(NSDictionary *)optionsDict 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.", @"") }];
Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/GTTree.h
Expand Up @@ -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, nullable) NSArray<GTTreeEntry *> *entries;

/// The underlying `git_object` as a `git_tree` object.
- (git_tree *)git_tree __attribute__((objc_returns_inner_pointer));
Expand Down
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -88,6 +88,8 @@ There are three ways of including ObjectiveGit in a project:

1. Commit the [`Cartfile.resolved`](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfileresolved)

2. Under “Build Settings”, add the following to “Header Search Paths”: `$(SRCROOT)/Carthage/Build/iOS/ObjectiveGit.framework/Headers/` to avoid [`git2/filter.h file not found` errors](https://github.com/libgit2/objective-git/issues/441).

The different instructions for iOS works around an [App Store submission bug](http://www.openradar.me/radar?id=6409498411401216) triggered by universal binaries.


Expand Down
10 changes: 8 additions & 2 deletions script/cibuild
Expand Up @@ -90,10 +90,16 @@ run_xctool ()
{
if [ -n "$XCWORKSPACE" ]
then
xctool -workspace "$XCWORKSPACE" $XCTOOL_OPTIONS "$@" 2>&1
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 "$@" 2>&1
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
Expand Down

0 comments on commit 4a6fd2d

Please sign in to comment.