diff --git a/app/src/lib/components/History.svelte b/app/src/lib/components/History.svelte index 9c1729fb5..a82c126bd 100644 --- a/app/src/lib/components/History.svelte +++ b/app/src/lib/components/History.svelte @@ -131,6 +131,8 @@
after: {entry.details?.trailers.find((t) => t.key === 'after')?.value}
+ {:else if ['CreateCommit'].includes(entry.details?.operation || '')} + message: {entry.details?.trailers.find((t) => t.key === 'message')?.value} {/if}
diff --git a/crates/gitbutler-core/src/ops/snapshot.rs b/crates/gitbutler-core/src/ops/snapshot.rs index 08ab0c4a2..7ff87d0cc 100644 --- a/crates/gitbutler-core/src/ops/snapshot.rs +++ b/crates/gitbutler-core/src/ops/snapshot.rs @@ -15,9 +15,19 @@ pub trait Snapshot { old_branch: Branch, update: BranchUpdateRequest, ) -> anyhow::Result<()>; + fn snapshot_commit_creation(&self, commit_message: String) -> anyhow::Result<()>; } impl Snapshot for T { + fn snapshot_commit_creation(&self, commit_message: String) -> anyhow::Result<()> { + let details = + SnapshotDetails::new(OperationType::CreateCommit).with_trailers(vec![Trailer { + key: "message".to_string(), + value: commit_message, + }]); + self.create_snapshot(details)?; + Ok(()) + } fn snapshot_branch_creation(&self, branch_name: String) -> anyhow::Result<()> { let details = SnapshotDetails::new(OperationType::CreateBranch).with_trailers(vec![Trailer { diff --git a/crates/gitbutler-core/src/virtual_branches/controller.rs b/crates/gitbutler-core/src/virtual_branches/controller.rs index 8de8e3780..c74f11449 100644 --- a/crates/gitbutler-core/src/virtual_branches/controller.rs +++ b/crates/gitbutler-core/src/virtual_branches/controller.rs @@ -3,6 +3,7 @@ use crate::{ ops::{ entry::{OperationType, SnapshotDetails}, oplog::Oplog, + snapshot::Snapshot, }, }; use std::{collections::HashMap, path::Path, sync::Arc}; @@ -484,7 +485,7 @@ impl ControllerInner { let _ = project_repository .project() - .create_snapshot(SnapshotDetails::new(OperationType::CreateCommit)); + .snapshot_commit_creation(message.to_owned()); result }) }