Skip to content

Commit 9886cf8

Browse files
committed
Added -[GTRepository checkoutTree:…]
1 parent daf6f64 commit 9886cf8

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

ObjectiveGit/GTRepository.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) {
548548

549549
/// Checkout a reference
550550
///
551-
/// targetCommit - The reference to checkout.
551+
/// targetReference - The reference to checkout.
552552
/// strategy - The checkout strategy to use.
553553
/// notifyFlags - Flags that indicate which notifications should cause `notifyBlock`
554554
/// to be called.
@@ -559,6 +559,20 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) {
559559
/// Returns YES if operation was successful, NO otherwise
560560
- (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;
561561

562+
/// Checkout a tree
563+
///
564+
/// targetTree - The tree to checkout.
565+
/// strategy - The checkout strategy to use.
566+
/// notifyFlags - Flags that indicate which notifications should cause `notifyBlock`
567+
/// to be called.
568+
/// error - The error if one occurred. Can be NULL.
569+
/// notifyBlock - The block to call back for notification handling. Can be nil.
570+
/// progressBlock - The block to call back for progress updates. Can be nil.
571+
///
572+
/// Returns YES if operation was successful, NO otherwise
573+
/// Note: this operation will NOT update HEAD to newly checked out tree.
574+
- (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;
575+
562576
/// Convenience wrapper for checkoutCommit:strategy:notifyFlags:error:notifyBlock:progressBlock without notifications
563577
- (BOOL)checkoutCommit:(GTCommit *)target strategy:(GTCheckoutStrategyType)strategy error:(NSError **)error progressBlock:(nullable void (^)(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps))progressBlock;
564578

ObjectiveGit/GTRepository.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,10 @@ - (BOOL)checkoutReference:(GTReference *)targetReference strategy:(GTCheckoutStr
868868
return [self moveHEADToReference:targetReference error:error];
869869
}
870870

871+
- (BOOL)checkoutTree:(GTTree *)targetTree strategy:(GTCheckoutStrategyType)strategy notifyFlags:(GTCheckoutNotifyFlags)notifyFlags error:(NSError **)error progressBlock:(GTCheckoutProgressBlock)progressBlock notifyBlock:(GTCheckoutNotifyBlock)notifyBlock {
872+
return [self performCheckout:targetTree withStrategy:strategy notifyFlags:notifyFlags error:error progressBlock:progressBlock notifyBlock:notifyBlock];;
873+
}
874+
871875
- (BOOL)checkoutCommit:(GTCommit *)target strategy:(GTCheckoutStrategyType)strategy error:(NSError **)error progressBlock:(GTCheckoutProgressBlock)progressBlock {
872876
return [self checkoutCommit:target strategy:strategy notifyFlags:GTCheckoutNotifyNone error:error progressBlock:progressBlock notifyBlock:nil];
873877
}

0 commit comments

Comments
 (0)