Merge pull request #3263 from gitbutlerapp/hunk-ownership-comparison-fix

fix: revert to using hunk equality with hashes
This commit is contained in:
Kiril Videlov 2024-03-21 22:28:34 +01:00 committed by GitHub
commit 36c555773c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2053,7 +2053,8 @@ fn get_applied_status(
// if any of the current hunks intersects with the owned hunk, we want to keep it
for (i, git_diff_hunk) in git_diff_hunks.iter().enumerate() {
let hash = diff_hash(&git_diff_hunk.diff);
if claimed_hunk.shallow_eq(git_diff_hunk) {
// Eq compares hashes first, and if one of the hunks lacks a hash, it compares line numbers
if claimed_hunk.eq(&Hunk::from(git_diff_hunk)) {
// try to re-use old timestamp
let timestamp = claimed_hunk.timestam_ms().unwrap_or(mtime);
// push hunk to the end of the list, preserving the order