mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-16 21:12:00 +03:00
Merge pull request #4168 from gitbutlerapp/fix-hunk-locking-logic
Fix bug in hunk -> branch assignment
This commit is contained in:
commit
881e9967c9
@ -1823,10 +1823,10 @@ fn get_applied_status(
|
|||||||
// if any of the current hunks intersects with the owned hunk, we want to keep it
|
// 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() {
|
for (i, git_diff_hunk) in git_diff_hunks.iter().enumerate() {
|
||||||
let hash = Hunk::hash_diff(&git_diff_hunk.diff_lines);
|
let hash = Hunk::hash_diff(&git_diff_hunk.diff_lines);
|
||||||
if locks.contains_key(&hash) {
|
|
||||||
return None; // Defer allocation to unclaimed hunks processing
|
|
||||||
}
|
|
||||||
if claimed_hunk.eq(&Hunk::from(git_diff_hunk)) {
|
if claimed_hunk.eq(&Hunk::from(git_diff_hunk)) {
|
||||||
|
if locks.contains_key(&hash) {
|
||||||
|
return None; // Defer allocation to unclaimed hunks processing
|
||||||
|
}
|
||||||
let timestamp = claimed_hunk.timestamp_ms().unwrap_or(mtime);
|
let timestamp = claimed_hunk.timestamp_ms().unwrap_or(mtime);
|
||||||
diffs_by_branch
|
diffs_by_branch
|
||||||
.entry(branch.id)
|
.entry(branch.id)
|
||||||
@ -1843,6 +1843,9 @@ fn get_applied_status(
|
|||||||
.with_hash(hash),
|
.with_hash(hash),
|
||||||
);
|
);
|
||||||
} else if claimed_hunk.intersects(git_diff_hunk) {
|
} else if claimed_hunk.intersects(git_diff_hunk) {
|
||||||
|
if locks.contains_key(&hash) {
|
||||||
|
return None; // Defer allocation to unclaimed hunks processing
|
||||||
|
}
|
||||||
diffs_by_branch
|
diffs_by_branch
|
||||||
.entry(branch.id)
|
.entry(branch.id)
|
||||||
.or_default()
|
.or_default()
|
||||||
|
Loading…
Reference in New Issue
Block a user