mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
PBGitCommitController: Fix unstaging of last hunk
When unstaging the last cached hunk of a file, the file remained in the "Staged Changes" column, with the notice "This file has no more changes" and the "Unstage"-button remaining in the diff-view. This fixes this behaviour by correctly distinguishing files in the files-array not only by filename but also by unstaged/cached status, s.t. for a file with unstaged and cached changes, there are two entries in the files-array. Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
This commit is contained in:
committed by
Pieter de Bie
parent
06d6da1fc5
commit
f4f505c25e
@@ -193,17 +193,17 @@
|
||||
// but rather update it to incorporate our changes
|
||||
for (PBChangedFile *file in files) {
|
||||
if ([file.path isEqualToString:line]) {
|
||||
file.shouldBeDeleted = NO;
|
||||
if (cached) {
|
||||
file.commitBlobSHA = sha;
|
||||
if (cached && file.hasCachedChanges) { // if we're listing cached files
|
||||
file.shouldBeDeleted = NO; // and the matching file in files had cached changes
|
||||
file.commitBlobSHA = sha; // we don't delete it
|
||||
file.commitBlobMode = mode;
|
||||
file.hasCachedChanges = YES;
|
||||
isNew = NO;
|
||||
break;
|
||||
} else if ((!cached) && file.hasUnstagedChanges) { // if we're listing unstaged files and the
|
||||
file.shouldBeDeleted = NO; // matching file in files had unstaged changes
|
||||
isNew = NO; // we don't delete it
|
||||
break;
|
||||
}
|
||||
else
|
||||
file.hasUnstagedChanges = YES;
|
||||
|
||||
isNew = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user