Skip to content

Commit 0d8ba8c

Browse files
committed
Rename 'CachedChanges" to "StagedChanges" for greater consistency
1 parent f9ff15c commit 0d8ba8c

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

PBChangedFile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ typedef enum {
1717

1818
@interface PBChangedFile : NSObject {
1919
NSString *path;
20-
BOOL hasCachedChanges;
20+
BOOL hasStagedChanges;
2121
BOOL hasUnstagedChanges;
2222

2323
// Index and HEAD stuff, to be used to revert changes
@@ -30,7 +30,7 @@ typedef enum {
3030

3131
@property (copy) NSString *path, *commitBlobSHA, *commitBlobMode;
3232
@property (assign) PBChangedFileStatus status;
33-
@property (assign) BOOL hasCachedChanges, hasUnstagedChanges;
33+
@property (assign) BOOL hasStagedChanges, hasUnstagedChanges;
3434

3535
- (NSImage *)icon;
3636
- (NSString *)indexInfo;

PBChangedFile.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
@implementation PBChangedFile
1313

14-
@synthesize path, status, hasCachedChanges, hasUnstagedChanges, commitBlobSHA, commitBlobMode;
14+
@synthesize path, status, hasStagedChanges, hasUnstagedChanges, commitBlobSHA, commitBlobMode;
1515

1616
- (id) initWithPath:(NSString *)p
1717
{

PBGitCommitController.m

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ @interface PBGitCommitController (PrivateMethods)
1616
- (NSArray *) linesFromNotification:(NSNotification *)notification;
1717
- (void) doneProcessingIndex;
1818
- (NSMutableDictionary *)dictionaryForLines:(NSArray *)lines;
19-
- (void) addFilesFromDictionary:(NSMutableDictionary *)dictionary cached:(BOOL)cached tracked:(BOOL)tracked;
19+
- (void) addFilesFromDictionary:(NSMutableDictionary *)dictionary staged:(BOOL)staged tracked:(BOOL)tracked;
2020
@end
2121

2222
@implementation PBGitCommitController
@@ -32,7 +32,7 @@ - (void)awakeFromNib
3232
[commitMessageView setTypingAttributes:[NSDictionary dictionaryWithObject:[NSFont fontWithName:@"Monaco" size:12.0] forKey:NSFontAttributeName]];
3333

3434
[unstagedFilesController setFilterPredicate:[NSPredicate predicateWithFormat:@"hasUnstagedChanges == 1"]];
35-
[cachedFilesController setFilterPredicate:[NSPredicate predicateWithFormat:@"hasCachedChanges == 1"]];
35+
[cachedFilesController setFilterPredicate:[NSPredicate predicateWithFormat:@"hasStagedChanges == 1"]];
3636

3737
[unstagedFilesController setSortDescriptors:[NSArray arrayWithObjects:
3838
[[NSSortDescriptor alloc] initWithKey:@"status" ascending:false],
@@ -148,7 +148,7 @@ - (void) doneProcessingIndex
148148
if (!--self.busy) {
149149
self.status = @"Ready";
150150
for (PBChangedFile *file in files) {
151-
if (!file.hasCachedChanges && !file.hasUnstagedChanges) {
151+
if (!file.hasStagedChanges && !file.hasUnstagedChanges) {
152152
NSLog(@"Deleting file: %@", [file path]);
153153
[files removeObject:file];
154154
}
@@ -169,7 +169,7 @@ - (void) readOtherFiles:(NSNotification *)notification;
169169
continue;
170170
[dictionary setObject:fileStatus forKey:path];
171171
}
172-
[self addFilesFromDictionary:dictionary cached:NO tracked:NO];
172+
[self addFilesFromDictionary:dictionary staged:NO tracked:NO];
173173
[self doneProcessingIndex];
174174
}
175175

@@ -193,7 +193,7 @@ - (NSMutableDictionary *)dictionaryForLines:(NSArray *)lines
193193
return dictionary;
194194
}
195195

196-
- (void) addFilesFromDictionary:(NSMutableDictionary *)dictionary cached:(BOOL)cached tracked:(BOOL)tracked
196+
- (void) addFilesFromDictionary:(NSMutableDictionary *)dictionary staged:(BOOL)staged tracked:(BOOL)tracked
197197
{
198198
// Iterate over all existing files
199199
for (PBChangedFile *file in files) {
@@ -204,22 +204,22 @@ - (void) addFilesFromDictionary:(NSMutableDictionary *)dictionary cached:(BOOL)c
204204
NSString *mode = [[fileStatus objectAtIndex:0] substringFromIndex:1];
205205
NSString *sha = [fileStatus objectAtIndex:2];
206206

207-
if (cached) {
208-
file.hasCachedChanges = YES;
207+
if (staged) {
208+
file.hasStagedChanges = YES;
209209
file.commitBlobSHA = sha;
210210
file.commitBlobMode = mode;
211211
} else
212212
file.hasUnstagedChanges = YES;
213213
} else {
214214
// Untracked file, set status to NEW, only unstaged changes
215-
file.hasCachedChanges = NO;
215+
file.hasStagedChanges = NO;
216216
file.hasUnstagedChanges = YES;
217217
file.status = NEW;
218218
}
219219
[dictionary removeObjectForKey:file.path];
220220
} else { // Object not found, let's remove it from the changes
221-
if (cached)
222-
file.hasCachedChanges = NO;
221+
if (staged)
222+
file.hasStagedChanges = NO;
223223
else if (tracked && file.status != NEW) // Only remove it if it's not an untracked file. We handle that with the other thing
224224
file.hasUnstagedChanges = NO;
225225
else if (!tracked && file.status == NEW)
@@ -239,13 +239,13 @@ - (void) addFilesFromDictionary:(NSMutableDictionary *)dictionary cached:(BOOL)c
239239
else
240240
file.status = MODIFIED;
241241

242-
if (cached) {
242+
if (staged) {
243243
file.commitBlobSHA = [[fileStatus objectAtIndex:0] substringFromIndex:1];
244244
file.commitBlobMode = [fileStatus objectAtIndex:2];
245245
}
246246

247-
file.hasCachedChanges = cached;
248-
file.hasUnstagedChanges = !cached;
247+
file.hasStagedChanges = staged;
248+
file.hasUnstagedChanges = !staged;
249249

250250
[files addObject: file];
251251
}
@@ -255,15 +255,15 @@ - (void) readUnstagedFiles:(NSNotification *)notification
255255
{
256256
NSArray *lines = [self linesFromNotification:notification];
257257
NSMutableDictionary *dic = [self dictionaryForLines:lines];
258-
[self addFilesFromDictionary:dic cached:NO tracked:YES];
258+
[self addFilesFromDictionary:dic staged:NO tracked:YES];
259259
[self doneProcessingIndex];
260260
}
261261

262262
- (void) readCachedFiles:(NSNotification *)notification
263263
{
264264
NSArray *lines = [self linesFromNotification:notification];
265265
NSMutableDictionary *dic = [self dictionaryForLines:lines];
266-
[self addFilesFromDictionary:dic cached:YES tracked:YES];
266+
[self addFilesFromDictionary:dic staged:YES tracked:YES];
267267
[self doneProcessingIndex];
268268
}
269269

PBGitIndexController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ - (void) stageFiles:(NSArray *)files
5858
for (PBChangedFile *file in files)
5959
{
6060
file.hasUnstagedChanges = NO;
61-
file.hasCachedChanges = YES;
61+
file.hasStagedChanges = YES;
6262
}
6363
[self resumeTrackingIndex];
6464
}
@@ -85,7 +85,7 @@ - (void) unstageFiles:(NSArray *)files
8585
for (PBChangedFile *file in files)
8686
{
8787
file.hasUnstagedChanges = YES;
88-
file.hasCachedChanges = NO;
88+
file.hasStagedChanges = NO;
8989
}
9090
[self resumeTrackingIndex];
9191
}

0 commit comments

Comments
 (0)