mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-22 00:51:38 +03:00
Merge pull request #3710 from gitbutlerapp/Don-t-parse-and-re-parse-branch_id
Don't reparse branch_id
This commit is contained in:
commit
cc642c4ea6
@ -9,6 +9,8 @@ use tracing::instrument;
|
|||||||
|
|
||||||
use super::Repository;
|
use super::Repository;
|
||||||
use crate::git;
|
use crate::git;
|
||||||
|
use crate::id::Id;
|
||||||
|
use crate::virtual_branches::Branch;
|
||||||
|
|
||||||
pub type DiffByPathMap = HashMap<PathBuf, FileDiff>;
|
pub type DiffByPathMap = HashMap<PathBuf, FileDiff>;
|
||||||
|
|
||||||
@ -106,7 +108,7 @@ impl GitHunk {
|
|||||||
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Copy)]
|
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Copy)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct HunkLock {
|
pub struct HunkLock {
|
||||||
pub branch_id: uuid::Uuid,
|
pub branch_id: Id<Branch>,
|
||||||
pub commit_id: git::Oid,
|
pub commit_id: git::Oid,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ use super::{
|
|||||||
branch_to_remote_branch, errors, target, RemoteBranch, VirtualBranchesHandle,
|
branch_to_remote_branch, errors, target, RemoteBranch, VirtualBranchesHandle,
|
||||||
};
|
};
|
||||||
use crate::git::diff::{diff_files_into_hunks, trees, FileDiff};
|
use crate::git::diff::{diff_files_into_hunks, trees, FileDiff};
|
||||||
use crate::id::Id;
|
|
||||||
use crate::virtual_branches::branch::HunkHash;
|
use crate::virtual_branches::branch::HunkHash;
|
||||||
use crate::{
|
use crate::{
|
||||||
askpass::AskpassBroker,
|
askpass::AskpassBroker,
|
||||||
@ -1794,12 +1793,9 @@ fn get_applied_status(
|
|||||||
let commit_id = git::Oid::from(blame_hunk.orig_commit_id());
|
let commit_id = git::Oid::from(blame_hunk.orig_commit_id());
|
||||||
if commit_id != *target_sha && commit_id != *integration_commit {
|
if commit_id != *target_sha && commit_id != *integration_commit {
|
||||||
let hash = Hunk::hash_diff(&hunk.diff_lines);
|
let hash = Hunk::hash_diff(&hunk.diff_lines);
|
||||||
let id = commit_to_branch.get(&commit_id).map(|id| id.to_string());
|
let Some(branch_id) = commit_to_branch.get(&commit_id) else {
|
||||||
let branch_id = if let Some(id) = id {
|
// This is a truly absurd situation
|
||||||
uuid::Uuid::parse_str(&id)?
|
// TODO: Test if this still happens
|
||||||
} else {
|
|
||||||
// Log the error and continue
|
|
||||||
// TODO: Why does that happen?
|
|
||||||
tracing::error!(
|
tracing::error!(
|
||||||
"commit {:?} not found in commit_to_branch map {:?}",
|
"commit {:?} not found in commit_to_branch map {:?}",
|
||||||
commit_id,
|
commit_id,
|
||||||
@ -1807,8 +1803,9 @@ fn get_applied_status(
|
|||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let hunk_lock = diff::HunkLock {
|
let hunk_lock = diff::HunkLock {
|
||||||
branch_id,
|
branch_id: *branch_id,
|
||||||
commit_id,
|
commit_id,
|
||||||
};
|
};
|
||||||
locked_hunk_map
|
locked_hunk_map
|
||||||
@ -1924,7 +1921,7 @@ fn get_applied_status(
|
|||||||
let first_lock = &locks[0];
|
let first_lock = &locks[0];
|
||||||
let p = virtual_branches
|
let p = virtual_branches
|
||||||
.iter()
|
.iter()
|
||||||
.position(|vb| vb.id == Id::<Branch>::from(first_lock.branch_id));
|
.position(|vb| vb.id == first_lock.branch_id);
|
||||||
match p {
|
match p {
|
||||||
Some(p) => p,
|
Some(p) => p,
|
||||||
_ => default_vbranch_pos,
|
_ => default_vbranch_pos,
|
||||||
|
Loading…
Reference in New Issue
Block a user