mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-01 14:04:57 +03:00
add message trailer for commit snapshots
This commit is contained in:
parent
af95a898cb
commit
06dfc95692
@ -131,6 +131,8 @@
|
||||
<div>
|
||||
after: {entry.details?.trailers.find((t) => t.key === 'after')?.value}
|
||||
</div>
|
||||
{:else if ['CreateCommit'].includes(entry.details?.operation || '')}
|
||||
message: {entry.details?.trailers.find((t) => t.key === 'message')?.value}
|
||||
{/if}
|
||||
</div>
|
||||
<div>
|
||||
|
@ -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<T: Oplog> 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 {
|
||||
|
@ -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
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user