fix some potentials for errors to bubble up (#547)

* fix some potentials for errors to bubble up (#490)
* fix async diff failing panic
This commit is contained in:
Stephan Dilly 2021-02-24 21:54:27 +01:00 committed by GitHub
parent 4a0e671197
commit 546c7f3072
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 8 deletions

View File

@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
![charcount](assets/char_count.gif)
### Fixed
- fix some potential errors when deleting files while they are being diffed ([#490](https://github.com/extrawurst/gitui/issues/490))
- push defaults to 'origin' remote if it exists ([#494](https://github.com/extrawurst/gitui/issues/494))
- support missing pageUp/down support in branchlist ([#519](https://github.com/extrawurst/gitui/issues/519))
- don't hide branch name while in commit dialog ([#529](https://github.com/extrawurst/gitui/issues/529))

View File

@ -5,7 +5,7 @@ profile:
cargo run --features=timing,pprof -- -l
debug:
cargo run --features=timing -- -l
RUST_BACKTRACE=true cargo run --features=timing -- -l
build-release:
cargo build --release

View File

@ -118,8 +118,14 @@ impl AsyncDiff {
arc_last,
arc_current,
hash,
)
.expect("error getting diff");
);
let notify = if let Err(err) = notify {
log::error!("get_diff_helper error: {}", err);
true
} else {
false
};
arc_pending.fetch_sub(1, Ordering::Relaxed);

View File

@ -518,6 +518,16 @@ impl DiffComponent {
);
}
fn stage_unstage_hunk(&mut self) -> Result<()> {
if self.current.is_stage {
self.unstage_hunk()?;
} else {
self.stage_hunk()?;
}
Ok(())
}
const fn is_stage(&self) -> bool {
self.current.is_stage
}
@ -659,11 +669,12 @@ impl Component for DiffComponent {
} else if e == self.key_config.enter
&& !self.is_immutable
{
if self.current.is_stage {
self.unstage_hunk()?;
} else {
self.stage_hunk()?;
}
try_or_popup!(
self,
"hunk error:",
self.stage_unstage_hunk()
);
Ok(true)
} else if e == self.key_config.status_reset_item
&& !self.is_immutable