Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unchanged files are listed for staging #99

Open
boxed opened this issue Mar 11, 2011 · 1 comment
Open

Unchanged files are listed for staging #99

boxed opened this issue Mar 11, 2011 · 1 comment

Comments

@boxed
Copy link

boxed commented Mar 11, 2011

Files that have been touched seem to be listed as modified even though when you click on them to get the diff nothing is displayed. This becomes really annoying after a while :P

@boxed
Copy link
Author

boxed commented Mar 15, 2011

I made the following hack that seems so far to be working for me. The gist of it is that "git diff-files" returns a bunch of files that are touched but not actually changed.

diff --git a/PBGitIndex.m b/PBGitIndex.m
index e41e5e5..4b29831 100644
--- a/PBGitIndex.m
+++ b/PBGitIndex.m
@@ -507,14 +507,14 @@ - (void)indexRefreshFinished:(NSNotification *)notification
        // Unstaged files
        refreshStatus++;
        handle = [PBEasyPipe handleForCommand:[PBGitBinary path] 
-                                                                                          withArgs:[NSArray arrayWithObjects:@"diff-files", @"-z", nil]
+                                                                                          withArgs:[NSArray arrayWithObjects:@"diff", @"--name-only", @"-z", nil]
                                                                                                  inDir:[workingDirectory path]];
        [nc addObserver:self selector:@selector(readUnstagedFiles:) name:NSFileHandleReadToEndOfFileCompletionNotification object:handle]; 
        [handle readToEndOfFileInBackgroundAndNotify];
 
        // Staged files
        refreshStatus++;
-       handle = [PBEasyPipe handleForCommand:[PBGitBinary path] 
+    handle = [PBEasyPipe handleForCommand:[PBGitBinary path] 
                                                                 withArgs:[NSArray arrayWithObjects:@"diff-index", @"--cached", @"-z", [self parentTree], nil]
                                                                        inDir:[workingDirectory path]];
        [nc addObserver:self selector:@selector(readStagedFiles:) name:NSFileHandleReadToEndOfFileCompletionNotification object:handle]; 
@@ -658,20 +658,11 @@ - (NSArray *)linesFromNotification:(NSNotification *)notification
 - (NSMutableDictionary *)dictionaryForLines:(NSArray *)lines
 {
        NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithCapacity:[lines count]/2];
-       
-       // Fill the dictionary with the new information. These lines are in the form of:
-       // :00000 :0644 OTHER INDEX INFORMATION
-       // Filename
-
-       NSAssert1([lines count] % 2 == 0, @"Lines must have an even number of lines: %@", lines);
-
-       NSEnumerator *enumerator = [lines objectEnumerator];
-       NSString *fileStatus;
-       while (fileStatus = [enumerator nextObject]) {
-               NSString *fileName = [enumerator nextObject];
-               [dictionary setObject:[fileStatus componentsSeparatedByString:@" "] forKey:fileName];
-       }
 
+    for (NSString* filename in lines) {
+        [dictionary setObject:[@"foo bar asd qwe c" componentsSeparatedByString:@" "] forKey:filename];
+    }
+    
        return dictionary;
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant