Prevent staged rename from displaying unstaged changes#491
Prevent staged rename from displaying unstaged changes#491harish wants to merge 1 commit intojonas:masterfrom harish:gh-472
Conversation
| } | ||
|
|
||
| /* Skip source filename in rename */ | ||
| if (buf.data[0] == 'R') |
There was a problem hiding this comment.
Shouldn't renames increase the diff->staged count? This patch will report the index as clean.
There was a problem hiding this comment.
This will still get incremented at line 163 as it did before. The next iteration where it reads in the 2nd filename will skip. Originally I used a counter because I thought it'd hit two filenames. Would it be more clear to use a flag like 'skip_next' or 'last_was_rename'?
There was a problem hiding this comment.
Yes, I missed that. I ended up putting an explicit io_get call to read the source filename since ok = buf.size > 3 was breaking for short filenames.
There was a problem hiding this comment.
I believe the || skip_count should've caught that case but I definitely like your version better-- much cleaner. Thanks :)
There was a problem hiding this comment.
Yes, it would have continued but ok would have become false due to the tricky assignment in the while condition causing the result of index_diff to be discarded
|
I think it would make sense to add a test for this |
|
Sure, I'll give it a shot. I'm having a little trouble running tests on OS X-- everything seems to fail. Any tips? make test |
|
@harish Thanks for the patch. I updated it and added some test cases. Regarding the problem with |
#472 - Took a whack at this. Appears that git status --porcelain -z outputs "R dst\0src\0" for a rename.