mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-02 18:01:05 +00:00
git_backend: cache head of saved extra metadata table
Just because we know the latest table head.
This commit is contained in:
parent
a9422460cb
commit
5dba0502cb
1 changed files with 5 additions and 2 deletions
|
@ -133,12 +133,15 @@ impl GitBackend {
|
|||
) -> BackendResult<()> {
|
||||
let mut mut_table = table.start_mutation();
|
||||
mut_table.add_entry(id.to_bytes(), extras);
|
||||
self.extra_metadata_store
|
||||
let table = self
|
||||
.extra_metadata_store
|
||||
.save_table(mut_table)
|
||||
.map_err(|err| {
|
||||
BackendError::Other(format!("Failed to write non-git metadata: {err}"))
|
||||
})?;
|
||||
*self.cached_extra_metadata.lock().unwrap() = None;
|
||||
// Since the parent table was the head, saved table are likely to be new head.
|
||||
// If it's not, cache will be reloaded when entry can't be found.
|
||||
*self.cached_extra_metadata.lock().unwrap() = Some(table);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue