mirror of
https://seed.radicle.dev/rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt.git
synced 2026-11-21 10:30:43 +08:00
git-storage: return previous targets
The Updated values only tell the updated value of the target. It can be useful to also return the previous value, e.g. for reporting, hooks, etc. Add `Option<Oid>` to the Update::Direct and Update::Symbolic variants. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
This commit is contained in:
@@ -99,7 +99,6 @@ pub struct SymrefTarget<'a> {
|
||||
pub target: Oid,
|
||||
}
|
||||
|
||||
// TODO: include the previous values
|
||||
/// The successful result of an [`Update`] applied to the refdb.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Updated {
|
||||
@@ -109,6 +108,8 @@ pub enum Updated {
|
||||
name: RefString,
|
||||
/// The new `target` of the reference that was updated.
|
||||
target: Oid,
|
||||
/// The previous target of the reference, if it existed.
|
||||
previous: Option<Oid>,
|
||||
},
|
||||
/// The [`Update::Symbolic`] was succesful.
|
||||
Symbolic {
|
||||
@@ -116,6 +117,8 @@ pub enum Updated {
|
||||
name: RefString,
|
||||
/// The new `target` of the reference that was updated.
|
||||
target: RefString,
|
||||
/// The previous peeled target of the reference, if it existed.
|
||||
previous: Option<Oid>,
|
||||
},
|
||||
/// The [`Update::Remove`] was succesful.
|
||||
Removed {
|
||||
|
||||
Reference in New Issue
Block a user