Merge pull request #3763 from gitbutlerapp/move-hunk-branch-updates-implementation

snapshots for move hunk include branch name
This commit is contained in:
Kiril Videlov 2024-05-14 15:10:48 +02:00 committed by GitHub
commit 569b792b34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -122,7 +122,7 @@
restored_from: {entry.details?.trailers
.find((t) => t.key === 'restored_from')
?.value?.slice(0, 7)}
{:else if ['DeleteBranch', 'CreateBranch', 'ApplyBranch', 'UnapplyBranch'].includes(entry.details?.operation || '')}
{:else if ['DeleteBranch', 'CreateBranch', 'ApplyBranch', 'UnapplyBranch', 'MoveHunk'].includes(entry.details?.operation || '')}
name: {entry.details?.trailers.find((t) => t.key === 'name')?.value}
{:else if ['ReorderBranches', 'UpdateBranchName', 'SelectDefaultVirtualBranch', 'UpdateBranchRemoteName'].includes(entry.details?.operation || '')}
<div>

View File

@ -96,7 +96,10 @@ impl<T: Oplog> Snapshot for T {
update: BranchUpdateRequest,
) -> anyhow::Result<()> {
let details = if update.ownership.is_some() {
SnapshotDetails::new(OperationType::MoveHunk)
SnapshotDetails::new(OperationType::MoveHunk).with_trailers(vec![Trailer {
key: "name".to_string(),
value: old_branch.name.to_string(),
}])
} else if let Some(name) = update.name {
SnapshotDetails::new(OperationType::UpdateBranchName).with_trailers(vec![
Trailer {