mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-01 12:26:02 +03:00
save error on undo commit snapshot
This commit is contained in:
parent
0f482934c8
commit
4b8d97a500
@ -34,13 +34,16 @@ impl Project {
|
||||
self.commit_snapshot(snapshot_tree, details)?;
|
||||
Ok(())
|
||||
}
|
||||
pub(crate) fn snapshot_commit_undo(&self, commit_sha: git::Oid) -> anyhow::Result<()> {
|
||||
let details =
|
||||
SnapshotDetails::new(OperationKind::UndoCommit).with_trailers(vec![Trailer {
|
||||
key: "sha".to_string(),
|
||||
value: commit_sha.to_string(),
|
||||
}]);
|
||||
self.create_snapshot(details)?;
|
||||
pub(crate) fn snapshot_commit_undo(
|
||||
&self,
|
||||
snapshot_tree: git::Oid,
|
||||
result: Result<&(), &Error>,
|
||||
commit_sha: git::Oid,
|
||||
) -> anyhow::Result<()> {
|
||||
let result = result.map(|_| Some(commit_sha.to_string()));
|
||||
let details = SnapshotDetails::new(OperationKind::UndoCommit)
|
||||
.with_trailers(result_trailer(result, "sha".to_string()));
|
||||
self.commit_snapshot(snapshot_tree, details)?;
|
||||
Ok(())
|
||||
}
|
||||
pub(crate) fn snapshot_commit_creation(
|
||||
|
@ -725,10 +725,17 @@ impl ControllerInner {
|
||||
let _permit = self.semaphore.acquire().await;
|
||||
|
||||
self.with_verify_branch(project_id, |project_repository, _| {
|
||||
let _ = project_repository
|
||||
.project()
|
||||
.snapshot_commit_undo(commit_oid);
|
||||
super::undo_commit(project_repository, branch_id, commit_oid).map_err(Into::into)
|
||||
let snapshot_tree = project_repository.project().prepare_snapshot();
|
||||
let result: Result<(), Error> =
|
||||
super::undo_commit(project_repository, branch_id, commit_oid).map_err(Into::into);
|
||||
let _ = snapshot_tree.and_then(|snapshot_tree| {
|
||||
project_repository.project().snapshot_commit_undo(
|
||||
snapshot_tree,
|
||||
result.as_ref(),
|
||||
commit_oid,
|
||||
)
|
||||
});
|
||||
result
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user