Skip to content

Commit ea0e227

Browse files
committed
Merge branch 'master' into delete_remote_named
2 parents f09f1c6 + ff3bd77 commit ea0e227

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1099
-417
lines changed

External/libgit2

Submodule libgit2 updated 536 files

ObjectiveGit/GTBlame.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
2424
/// blame - A git_blame to wrap. May not be NULL.
2525
///
2626
/// Returns a blame, or nil if initialization failed.
27-
- (nullable instancetype)initWithGitBlame:(git_blame *)blame NS_DESIGNATED_INITIALIZER;
27+
- (instancetype _Nullable)initWithGitBlame:(git_blame *)blame NS_DESIGNATED_INITIALIZER;
2828

2929
/// Get all the hunks in the blame. A convenience wrapper around `enumerateHunksUsingBlock:`
3030
@property (nonatomic, strong, readonly) NSArray<GTBlameHunk *> *hunks;
@@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
3737
/// index - The index to retrieve the hunk from.
3838
///
3939
/// Returns a `GTBlameHunk` or nil if an error occurred.
40-
- (nullable GTBlameHunk *)hunkAtIndex:(NSUInteger)index;
40+
- (GTBlameHunk * _Nullable)hunkAtIndex:(NSUInteger)index;
4141

4242
/// Enumerate the hunks in the blame.
4343
///
@@ -52,7 +52,7 @@ NS_ASSUME_NONNULL_BEGIN
5252
/// lineNumber - The (1 based) line number to find a hunk for.
5353
///
5454
/// Returns a `GTBlameHunk` or nil if an error occurred.
55-
- (nullable GTBlameHunk *)hunkAtLineNumber:(NSUInteger)lineNumber;
55+
- (GTBlameHunk * _Nullable)hunkAtLineNumber:(NSUInteger)lineNumber;
5656

5757
/// The underlying `git_blame` object.
5858
- (git_blame *)git_blame __attribute__((objc_returns_inner_pointer));

ObjectiveGit/GTBlameHunk.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ NS_ASSUME_NONNULL_BEGIN
2424
/// hunk - A git_blame_hunk to wrap. May not be NULL.
2525
///
2626
/// Returns a blame hunk, or nil if initialization failed.
27-
- (nullable instancetype)initWithGitBlameHunk:(git_blame_hunk)hunk NS_DESIGNATED_INITIALIZER;
27+
- (instancetype _Nullable)initWithGitBlameHunk:(git_blame_hunk)hunk NS_DESIGNATED_INITIALIZER;
2828

2929
/// A NSRange where `location` is the (1 based) starting line number,
3030
/// and `length` is the number of lines in the hunk.
3131
@property (nonatomic, readonly) NSRange lines;
3232

3333
/// The OID of the commit where this hunk was last changed.
34-
@property (nonatomic, readonly, copy, nullable) GTOID *finalCommitOID;
34+
@property (nonatomic, readonly, copy) GTOID * _Nullable finalCommitOID;
3535

3636
/// The signature of the commit where this hunk was last changed.
37-
@property (nonatomic, readonly, nullable) GTSignature *finalSignature;
37+
@property (nonatomic, readonly) GTSignature * _Nullable finalSignature;
3838

3939
/// The path of the file in the original commit.
4040
@property (nonatomic, readonly, copy) NSString *originalPath;

ObjectiveGit/GTBlob.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
4343
/// error - Will be set if an error occurs. This may be nil.
4444
///
4545
/// Return a newly created blob object, or nil if an error occurs.
46-
+ (nullable instancetype)blobWithString:(NSString *)string inRepository:(GTRepository *)repository error:(NSError **)error;
46+
+ (instancetype _Nullable)blobWithString:(NSString *)string inRepository:(GTRepository *)repository error:(NSError **)error;
4747

4848
/// Creates a new blob from the given data.
4949
///
@@ -54,7 +54,7 @@ NS_ASSUME_NONNULL_BEGIN
5454
/// error - Will be set if an error occurs. This may be nil.
5555
///
5656
/// Return a newly created blob object, or nil if an error occurs.
57-
+ (nullable instancetype)blobWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError **)error;
57+
+ (instancetype _Nullable)blobWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError **)error;
5858

5959
/// Creates a new blob given an NSURL to a file.
6060
///
@@ -65,7 +65,7 @@ NS_ASSUME_NONNULL_BEGIN
6565
/// error - Will be set if an error occurs. This may be nil.
6666
///
6767
/// Return a newly created blob object, or nil if an error occurs.
68-
+ (nullable instancetype)blobWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError **)error;
68+
+ (instancetype _Nullable)blobWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError **)error;
6969

7070
/// Creates a new blob from the given string.
7171
///
@@ -76,7 +76,7 @@ NS_ASSUME_NONNULL_BEGIN
7676
/// error - Will be set if an error occurs. This may be nil.
7777
///
7878
/// Return a newly created blob object, or nil if an error occurs.
79-
- (nullable instancetype)initWithString:(NSString *)string inRepository:(GTRepository *)repository error:(NSError **)error;
79+
- (instancetype _Nullable)initWithString:(NSString *)string inRepository:(GTRepository *)repository error:(NSError **)error;
8080

8181
/// Creates a new blob from the passed data.
8282
///
@@ -87,7 +87,7 @@ NS_ASSUME_NONNULL_BEGIN
8787
/// error - Will be set if an error occurs. This may be nil.
8888
///
8989
/// Returns a newly created blob object, or nil if an error occurs.
90-
- (nullable instancetype)initWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError **)error;
90+
- (instancetype _Nullable)initWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError **)error;
9191

9292
/// Creates a new blob from the specified file.
9393
///
@@ -98,22 +98,22 @@ NS_ASSUME_NONNULL_BEGIN
9898
/// error - Will be set if an error occurs. This may be nil.
9999
///
100100
/// Returns a newly created blob object, or nil if an error occurs.
101-
- (nullable instancetype)initWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError **)error;
101+
- (instancetype _Nullable)initWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError **)error;
102102

103103
/// The underlying `git_object` as a `git_blob` object.
104104
- (git_blob *)git_blob __attribute__((objc_returns_inner_pointer));
105105

106106
- (git_off_t)size;
107107
- (NSString *)content;
108-
- (nullable NSData *)data;
108+
- (NSData * _Nullable)data;
109109

110110
/// Attempts to apply the filter list for `path` to the blob.
111111
///
112112
/// path - The path to use filters from. Must not be nil.
113113
/// error - If not NULL, set to any error that occurs.
114114
///
115115
/// Returns the filtered data, or nil if an error occurs.
116-
- (nullable NSData *)applyFiltersForPath:(NSString *)path error:(NSError **)error;
116+
- (NSData * _Nullable)applyFiltersForPath:(NSString *)path error:(NSError **)error;
117117

118118
@end
119119

ObjectiveGit/GTBranch.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ NS_ASSUME_NONNULL_BEGIN
4343
/// equal.
4444
@interface GTBranch : NSObject
4545

46-
@property (nonatomic, readonly, nullable) NSString *name;
47-
@property (nonatomic, readonly, nullable) NSString *shortName;
48-
@property (nonatomic, copy, readonly, nullable) GTOID *OID;
49-
@property (nonatomic, readonly, nullable) NSString *remoteName;
46+
@property (nonatomic, readonly) NSString * _Nullable name;
47+
@property (nonatomic, readonly) NSString * _Nullable shortName;
48+
@property (nonatomic, copy, readonly) GTOID * _Nullable OID;
49+
@property (nonatomic, readonly) NSString * _Nullable remoteName;
5050
@property (nonatomic, readonly) GTBranchType branchType;
5151
@property (nonatomic, readonly, strong) GTRepository *repository;
5252
@property (nonatomic, readonly, strong) GTReference *reference;
@@ -62,22 +62,22 @@ NS_ASSUME_NONNULL_BEGIN
6262
/// repo - The repository containing the branch. Must not be nil.
6363
///
6464
/// Returns the initialized receiver.
65-
- (nullable instancetype)initWithReference:(GTReference *)ref repository:(GTRepository *)repo NS_DESIGNATED_INITIALIZER;
65+
- (instancetype _Nullable)initWithReference:(GTReference *)ref repository:(GTRepository *)repo NS_DESIGNATED_INITIALIZER;
6666

6767
/// Convenience class initializer.
6868
///
6969
/// ref - The branch reference to wrap. Must not be nil.
7070
/// repo - The repository containing the branch. Must not be nil.
7171
///
7272
/// Returns an initialized instance.
73-
+ (nullable instancetype)branchWithReference:(GTReference *)ref repository:(GTRepository *)repo;
73+
+ (instancetype _Nullable)branchWithReference:(GTReference *)ref repository:(GTRepository *)repo;
7474

7575
/// Get the target commit for this branch
7676
///
7777
/// error(out) - will be filled if an error occurs
7878
///
7979
/// returns a GTCommit object or nil if an error occurred
80-
- (nullable GTCommit *)targetCommitWithError:(NSError **)error;
80+
- (GTCommit * _Nullable)targetCommitWithError:(NSError **)error;
8181

8282
/// Count all commits in this branch
8383
///
@@ -92,15 +92,15 @@ NS_ASSUME_NONNULL_BEGIN
9292
/// error - If not NULL, set to any error that occurs.
9393
///
9494
/// Returns a (possibly empty) array of GTCommits, or nil if an error occurs.
95-
- (nullable NSArray<GTCommit *> *)uniqueCommitsRelativeToBranch:(GTBranch *)otherBranch error:(NSError **)error;
95+
- (NSArray<GTCommit *> * _Nullable)uniqueCommitsRelativeToBranch:(GTBranch *)otherBranch error:(NSError **)error;
9696

9797
/// Deletes the local branch and nils out the reference.
9898
- (BOOL)deleteWithError:(NSError **)error;
9999

100100
/// If the receiver is a local branch, looks up and returns its tracking branch.
101101
/// If the receiver is a remote branch, returns self. If no tracking branch was
102102
/// found, returns nil and sets `success` to YES.
103-
- (nullable GTBranch *)trackingBranchWithError:(NSError **)error success:(nullable BOOL *)success;
103+
- (GTBranch * _Nullable)trackingBranchWithError:(NSError **)error success:(BOOL * _Nullable)success;
104104

105105
/// Update the tracking branch.
106106
///
@@ -109,7 +109,7 @@ NS_ASSUME_NONNULL_BEGIN
109109
/// error - The error if one occurred.
110110
///
111111
/// Returns whether it was successful.
112-
- (BOOL)updateTrackingBranch:(nullable GTBranch *)trackingBranch error:(NSError **)error;
112+
- (BOOL)updateTrackingBranch:(GTBranch * _Nullable)trackingBranch error:(NSError **)error;
113113

114114
/// Reloads the branch's reference and creates a new branch based off that newly
115115
/// loaded reference.
@@ -119,7 +119,7 @@ NS_ASSUME_NONNULL_BEGIN
119119
/// error - The error if one occurred.
120120
///
121121
/// Returns the reloaded branch, or nil if an error occurred.
122-
- (nullable GTBranch *)reloadedBranchWithError:(NSError **)error;
122+
- (GTBranch * _Nullable)reloadedBranchWithError:(NSError **)error;
123123

124124
/// Calculate the ahead/behind count from this branch to the given branch.
125125
///

ObjectiveGit/GTBranch.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ + (NSString *)remoteNamePrefix {
6565
return @"refs/remotes/";
6666
}
6767

68-
+ (nullable instancetype)branchWithReference:(GTReference *)ref repository:(GTRepository *)repo {
68+
+ (instancetype)branchWithReference:(GTReference *)ref repository:(GTRepository *)repo {
6969
return [[self alloc] initWithReference:ref repository:repo];
7070
}
7171

@@ -74,7 +74,7 @@ - (instancetype)init {
7474
return nil;
7575
}
7676

77-
- (nullable instancetype)initWithReference:(GTReference *)ref repository:(GTRepository *)repo {
77+
- (instancetype)initWithReference:(GTReference *)ref repository:(GTRepository *)repo {
7878
NSParameterAssert(ref != nil);
7979
NSParameterAssert(repo != nil);
8080

ObjectiveGit/GTCheckoutOptions.h

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
//
2+
// GTCheckoutOptions.h
3+
// ObjectiveGitFramework
4+
//
5+
// Created by Etienne on 10/04/2015.
6+
// Copyright (c) 2015 GitHub, Inc. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
#import "git2/checkout.h"
11+
12+
@class GTDiffFile;
13+
14+
NS_ASSUME_NONNULL_BEGIN
15+
16+
/// Checkout strategies used by the various -checkout... methods
17+
/// See git_checkout_strategy_t
18+
typedef NS_OPTIONS(NSInteger, GTCheckoutStrategyType) {
19+
GTCheckoutStrategyNone = GIT_CHECKOUT_NONE,
20+
GTCheckoutStrategySafe = GIT_CHECKOUT_SAFE,
21+
GTCheckoutStrategyForce = GIT_CHECKOUT_FORCE,
22+
GTCheckoutStrategyRecreateMissing = GIT_CHECKOUT_RECREATE_MISSING,
23+
GTCheckoutStrategyAllowConflicts = GIT_CHECKOUT_ALLOW_CONFLICTS,
24+
GTCheckoutStrategyRemoveUntracked = GIT_CHECKOUT_REMOVE_UNTRACKED,
25+
GTCheckoutStrategyRemoveIgnored = GIT_CHECKOUT_REMOVE_IGNORED,
26+
GTCheckoutStrategyUpdateOnly = GIT_CHECKOUT_UPDATE_ONLY,
27+
GTCheckoutStrategyDontUpdateIndex = GIT_CHECKOUT_DONT_UPDATE_INDEX,
28+
GTCheckoutStrategyNoRefresh = GIT_CHECKOUT_NO_REFRESH,
29+
GTCheckoutStrategySkipUnmerged = GIT_CHECKOUT_SKIP_UNMERGED,
30+
GTCheckoutStrategyUseOurs = GIT_CHECKOUT_USE_OURS,
31+
GTCheckoutStrategyUseTheirs = GIT_CHECKOUT_USE_THEIRS,
32+
GTCheckoutStrategyDisablePathspecMatch = GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH,
33+
GTCheckoutStrategySkipLockedDirectories = GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES,
34+
GTCheckoutStrategyDoNotOverwriteIgnored = GIT_CHECKOUT_DONT_OVERWRITE_IGNORED,
35+
GTCheckoutStrategyConflictStyleMerge = GIT_CHECKOUT_CONFLICT_STYLE_MERGE,
36+
GTCheckoutStrategyCoflictStyleDiff3 = GIT_CHECKOUT_CONFLICT_STYLE_DIFF3,
37+
GTCheckoutStrategyDoNotRemoveExisting = GIT_CHECKOUT_DONT_REMOVE_EXISTING,
38+
GTCheckoutStrategyDoNotWriteIndex = GIT_CHECKOUT_DONT_WRITE_INDEX,
39+
};
40+
41+
/// Checkout notification flags used by the various -checkout... methods
42+
/// See git_checkout_notify_t
43+
typedef NS_OPTIONS(NSInteger, GTCheckoutNotifyFlags) {
44+
GTCheckoutNotifyNone = GIT_CHECKOUT_NOTIFY_NONE,
45+
GTCheckoutNotifyConflict = GIT_CHECKOUT_NOTIFY_CONFLICT,
46+
GTCheckoutNotifyDirty = GIT_CHECKOUT_NOTIFY_DIRTY,
47+
GTCheckoutNotifyUpdated = GIT_CHECKOUT_NOTIFY_UPDATED,
48+
GTCheckoutNotifyUntracked = GIT_CHECKOUT_NOTIFY_UNTRACKED,
49+
GTCheckoutNotifyIgnored = GIT_CHECKOUT_NOTIFY_IGNORED,
50+
51+
GTCheckoutNotifyAll = GIT_CHECKOUT_NOTIFY_ALL,
52+
};
53+
54+
@interface GTCheckoutOptions : NSObject
55+
56+
/// Create a checkout options object.
57+
///
58+
/// Since there are many places where we can checkout data, this object allow us
59+
/// to centralize all the various behaviors that checkout allow.
60+
///
61+
/// @param strategy The checkout strategy to use.
62+
/// @param notifyFlags The checkout events that will be notified via `notifyBlock`.
63+
/// @param progressBlock A block that will be called for each checkout step.
64+
/// @param notifyBlock A block that will be called for each event, @see `notifyFlags`.
65+
///
66+
/// @return A newly-initialized GTCheckoutOptions object.
67+
+ (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;
68+
69+
/// Create a checkout options object.
70+
/// @see +checkoutOptionsWithStrategy:notifyFlags:progressBlock:notifyBlock:
71+
+ (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags notifyBlock:(int (^)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir))notifyBlock;
72+
73+
/// Create a checkout options object.
74+
/// @see +checkoutOptionsWithStrategy:notifyFlags:progressBlock:notifyBlock:
75+
+ (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy progressBlock:(void (^)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps))progressBlock;
76+
77+
/// Create a checkout options object.
78+
/// @see +checkoutOptionsWithStrategy:notifyFlags:progressBlock:notifyBlock:
79+
+ (instancetype)checkoutOptionsWithStrategy:(GTCheckoutStrategyType)strategy;
80+
81+
/// Get the underlying git_checkout_options struct.
82+
///
83+
/// @return <#return value description#>
84+
- (git_checkout_options *)git_checkoutOptions NS_RETURNS_INNER_POINTER;
85+
86+
/// The checkout strategy to use.
87+
@property (assign) GTCheckoutStrategyType strategy;
88+
89+
/// The checkout progress block that was passed in.
90+
@property (copy) void (^progressBlock)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps);
91+
92+
/// The notification flags currently enabled.
93+
@property (assign) GTCheckoutNotifyFlags notifyFlags;
94+
95+
/// The checkout notification block that was passed in.
96+
@property (copy) int (^notifyBlock)(GTCheckoutNotifyFlags why, NSString *path, GTDiffFile *baseline, GTDiffFile *target, GTDiffFile *workdir);
97+
98+
/// An array of strings used to restrict what will be checked out.
99+
@property (copy) NSArray <NSString *> *pathSpecs;
100+
101+
@end
102+
103+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)