mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-28 04:47:42 +03:00
whenever a hunk is reversed also reverse change type
This commit is contained in:
parent
199129162d
commit
8ad8797b5d
@ -387,6 +387,11 @@ fn reverse_patch(patch: &BStr) -> Option<BString> {
|
||||
|
||||
// returns `None` if the reversal failed
|
||||
pub fn reverse_hunk(hunk: &GitHunk) -> Option<GitHunk> {
|
||||
let new_change_type = match hunk.change_type {
|
||||
ChangeType::Added => ChangeType::Deleted,
|
||||
ChangeType::Deleted => ChangeType::Added,
|
||||
ChangeType::Modified => ChangeType::Modified,
|
||||
};
|
||||
if hunk.binary {
|
||||
None
|
||||
} else {
|
||||
@ -397,7 +402,7 @@ pub fn reverse_hunk(hunk: &GitHunk) -> Option<GitHunk> {
|
||||
new_lines: hunk.old_lines,
|
||||
diff_lines: diff.into(),
|
||||
binary: hunk.binary,
|
||||
change_type: hunk.change_type,
|
||||
change_type: new_change_type,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user