fix tags being fetched every scroll in revlog (#851)

This commit is contained in:
Stephan Dilly 2021-08-17 13:35:59 +02:00 committed by GitHub
parent 55f224c5ca
commit 0b48e6f4ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 6 deletions

View file

@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Fixed
- do not allow to ignore .gitignore files ([#825](https://github.com/extrawurst/gitui/issues/825))
- crash in shallow repo ([#836](https://github.com/extrawurst/gitui/issues/836))
- fixed performance regression in revlog ([#850](https://github.com/extrawurst/gitui/issues/850))
## [0.16.2] - 2021-07-10

View file

@ -66,7 +66,13 @@ impl AsyncTags {
) -> Result<()> {
log::trace!("request");
if !force && (self.is_pending() || !self.is_outdated(dur)?) {
if !force && self.is_pending() {
return Ok(());
}
let outdated = self.is_outdated(dur)?;
if !force && !outdated {
return Ok(());
}
@ -77,8 +83,8 @@ impl AsyncTags {
self.pending.fetch_add(1, Ordering::Relaxed);
rayon_core::spawn(move || {
let notify =
Self::getter(&arc_last).expect("error getting tags");
let notify = Self::getter(&arc_last, outdated)
.expect("error getting tags");
arc_pending.fetch_sub(1, Ordering::Relaxed);
@ -96,14 +102,16 @@ impl AsyncTags {
fn getter(
arc_last: &Arc<Mutex<Option<(Instant, TagsResult)>>>,
outdated: bool,
) -> Result<bool> {
let tags = sync::get_tags(CWD)?;
let hash = hash(&tags);
if Self::last_hash(arc_last)
.map(|last| last == hash)
.unwrap_or_default()
if !outdated
&& Self::last_hash(arc_last)
.map(|last| last == hash)
.unwrap_or_default()
{
return Ok(false);
}