File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -526,6 +526,15 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) {
526526// / Returns YES if operation was successful, NO otherwise
527527- (BOOL )checkoutReference : (GTReference *)targetReference options : (nullable GTCheckoutOptions *)options error : (NSError **)error ;
528528
529+ // / Checkout an index
530+ // /
531+ // / index - The index to checkout. Must not be nil.
532+ // / options - The checkout options to use. Can be nil.
533+ // / error - The error if one occurred. Can be NULL.
534+ // /
535+ // / Returns YES if operation was successful, NO otherwise
536+ - (BOOL )checkoutIndex : (GTIndex *)index options : (nullable GTCheckoutOptions *)options error : (NSError **)error ;
537+
529538// / Flush the gitattributes cache.
530539- (void )flushAttributesCache ;
531540
Original file line number Diff line number Diff line change @@ -831,6 +831,15 @@ - (BOOL)checkoutReference:(GTReference *)targetReference options:(GTCheckoutOpti
831831 return [self moveHEADToReference: targetReference error: error];
832832}
833833
834+ - (BOOL )checkoutIndex : (GTIndex *)index options : (GTCheckoutOptions *)options error : (NSError **)error {
835+ int gitError = git_checkout_index (self.git_repository , index.git_index , options.git_checkoutOptions );
836+ if (gitError < GIT_OK) {
837+ if (error != NULL ) *error = [NSError git_errorFor: gitError description: @" Failed to checkout index." ];
838+ return NO ;
839+ }
840+ return YES ;
841+ }
842+
834843- (void )flushAttributesCache {
835844 git_attr_cache_flush (self.git_repository );
836845}
You can’t perform that action at this time.
0 commit comments