File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -71,10 +71,10 @@ extern NSString * const GTRepositoryCloneOptionsBare;
7171
7272// / An `NSNumber` wrapped `BOOL`, if NO, don't checkout the remote HEAD.
7373// / Default value is `YES`.
74- extern NSString * const GTRepositoryCloneOptionsCheckout ;
74+ extern NSString * const GTRepositoryCloneOptionsPerformCheckout ;
7575
7676// / A `GTCheckoutOptions` object describing how to perform the checkout.
77- extern NSString * const GTRepositoryCloneCheckoutOptions ;
77+ extern NSString * const GTRepositoryCloneOptionsCheckoutOptions ;
7878
7979// / A `GTCredentialProvider`, that will be used to authenticate against the
8080// / remote.
Original file line number Diff line number Diff line change 6060#import " git2.h"
6161
6262NSString * const GTRepositoryCloneOptionsBare = @" GTRepositoryCloneOptionsBare" ;
63- NSString * const GTRepositoryCloneCheckoutOptions = @" GTRepositoryCloneCheckoutOptions" ;
63+ NSString * const GTRepositoryCloneOptionsPerformCheckout = @" GTRepositoryCloneOptionsPerformCheckout" ;
64+ NSString * const GTRepositoryCloneOptionsCheckoutOptions = @" GTRepositoryCloneOptionsCheckoutOptions" ;
6465NSString * const GTRepositoryCloneOptionsTransportFlags = @" GTRepositoryCloneOptionsTransportFlags" ;
6566NSString * const GTRepositoryCloneOptionsCredentialProvider = @" GTRepositoryCloneOptionsCredentialProvider" ;
6667NSString * const GTRepositoryCloneOptionsCloneLocal = @" GTRepositoryCloneOptionsCloneLocal" ;
@@ -248,7 +249,14 @@ + (nullable instancetype)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSU
248249 NSNumber *bare = options[GTRepositoryCloneOptionsBare];
249250 cloneOptions.bare = (bare == nil ? 0 : bare.boolValue );
250251
251- GTCheckoutOptions *checkoutOptions = options[GTRepositoryCloneCheckoutOptions];
252+ NSNumber *checkout = options[GTRepositoryCloneOptionsPerformCheckout];
253+ BOOL doCheckout = (checkout != nil ? [checkout boolValue ] : YES );
254+
255+ GTCheckoutOptions *checkoutOptions = options[GTRepositoryCloneOptionsCheckoutOptions];
256+ if (checkoutOptions == nil && doCheckout) {
257+ checkoutOptions = [GTCheckoutOptions checkoutOptionsWithStrategy: GTCheckoutStrategySafe];
258+ }
259+
252260 if (checkoutOptions != nil ) {
253261 cloneOptions.checkout_opts = *(checkoutOptions.git_checkoutOptions );
254262 }
You can’t perform that action at this time.
0 commit comments