Skip to content

Commit 52e896b

Browse files
committed
kit: core live repository file pattern has been added.
1 parent b0b84e4 commit 52e896b

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

GitUpKit/Core/GCLiveRepository.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ extern NSString* const GCLiveRepositoryAmendOperationReason;
9999
@property(nonatomic, readonly) GCDiff* workingDirectoryStatus; // Nil on error
100100
@property(nonatomic, readonly) GCDiff* indexStatus; // Nil on error
101101
@property(nonatomic, readonly) NSDictionary* indexConflicts; // Nil on error
102+
@property(nonatomic, copy) NSString *filePattern;
103+
- (void)updateFilePattern:(NSString *)filePattern;
102104

103105
@property(nonatomic, getter=areStashesEnabled) BOOL stashesEnabled; // Default is NO - Should be enabled *after* setting delegate so any error can be received
104106
@property(nonatomic, readonly) NSArray* stashes; // Nil on error

GitUpKit/Core/GCLiveRepository.m

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ - (void)_updateStatus:(BOOL)notify {
629629

630630
CFAbsoluteTime time = CFAbsoluteTimeGetCurrent();
631631
if (_statusMode == kGCLiveRepositoryStatusMode_Unified) {
632-
unifiedDiff = [self diffWorkingDirectoryWithHEAD:nil
632+
unifiedDiff = [self diffWorkingDirectoryWithHEAD:self.filePattern
633633
options:(self.diffBaseOptions | kGCDiffOption_IncludeUntracked | kGCDiffOption_FindRenames)
634634
maxInterHunkLines:_diffMaxInterHunkLines
635635
maxContextLines:_diffMaxContextLines
@@ -639,13 +639,13 @@ - (void)_updateStatus:(BOOL)notify {
639639
}
640640
} else {
641641
XLOG_DEBUG_CHECK(_statusMode == kGCLiveRepositoryStatusMode_Normal);
642-
indexDiff = [self diffRepositoryIndexWithHEAD:nil
642+
indexDiff = [self diffRepositoryIndexWithHEAD:self.filePattern
643643
options:(self.diffBaseOptions | kGCDiffOption_FindRenames)
644644
maxInterHunkLines:_diffMaxInterHunkLines
645645
maxContextLines:_diffMaxContextLines
646646
error:&error];
647647
if (indexDiff) {
648-
workdirDiff = [self diffWorkingDirectoryWithRepositoryIndex:nil
648+
workdirDiff = [self diffWorkingDirectoryWithRepositoryIndex:self.filePattern
649649
options:(self.diffBaseOptions | kGCDiffOption_IncludeUntracked)
650650
maxInterHunkLines:_diffMaxInterHunkLines
651651
maxContextLines:_diffMaxContextLines
@@ -725,6 +725,15 @@ - (void)_updateStashes:(BOOL)notify {
725725
}
726726
}
727727

728+
#pragma mark - FilePattern
729+
- (void)updateFilePattern:(NSString *)filePattern {
730+
if ([self.filePattern isEqualToString:filePattern]) {
731+
return;
732+
}
733+
self.filePattern = filePattern == nil ? nil : [NSString stringWithFormat:@"*%@*", filePattern];
734+
[self _updateStatus:YES];
735+
}
736+
728737
#pragma mark - Operations
729738

730739
- (void)setUndoManager:(NSUndoManager*)undoManager {

0 commit comments

Comments
 (0)