Skip to content

Commit f2f6724

Browse files
author
Stephan Dilly
committed
fix some potentials for errors to bubble up (#547)
* fix some potentials for errors to bubble up (#490) * fix async diff failing panic
1 parent ee94e13 commit f2f6724

File tree

4 files changed

+26
-8
lines changed

4 files changed

+26
-8
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
![charcount](assets/char_count.gif)
1515

1616
### Fixed
17+
- fix some potential errors when deleting files while they are being diffed ([#490](https://github.com/extrawurst/gitui/issues/490))
1718
- push defaults to 'origin' remote if it exists ([#494](https://github.com/extrawurst/gitui/issues/494))
1819
- support missing pageUp/down support in branchlist ([#519](https://github.com/extrawurst/gitui/issues/519))
1920
- don't hide branch name while in commit dialog ([#529](https://github.com/extrawurst/gitui/issues/529))

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ profile:
55
cargo run --features=timing,pprof -- -l
66

77
debug:
8-
cargo run --features=timing -- -l
8+
RUST_BACKTRACE=true cargo run --features=timing -- -l
99

1010
build-release:
1111
cargo build --release

Diff for: asyncgit/src/diff.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,14 @@ impl AsyncDiff {
118118
arc_last,
119119
arc_current,
120120
hash,
121-
)
122-
.expect("error getting diff");
121+
);
122+
123+
let notify = if let Err(err) = notify {
124+
log::error!("get_diff_helper error: {}", err);
125+
true
126+
} else {
127+
false
128+
};
123129

124130
arc_pending.fetch_sub(1, Ordering::Relaxed);
125131

Diff for: src/components/diff.rs

+16-5
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,16 @@ impl DiffComponent {
518518
);
519519
}
520520

521+
fn stage_unstage_hunk(&mut self) -> Result<()> {
522+
if self.current.is_stage {
523+
self.unstage_hunk()?;
524+
} else {
525+
self.stage_hunk()?;
526+
}
527+
528+
Ok(())
529+
}
530+
521531
const fn is_stage(&self) -> bool {
522532
self.current.is_stage
523533
}
@@ -659,11 +669,12 @@ impl Component for DiffComponent {
659669
} else if e == self.key_config.enter
660670
&& !self.is_immutable
661671
{
662-
if self.current.is_stage {
663-
self.unstage_hunk()?;
664-
} else {
665-
self.stage_hunk()?;
666-
}
672+
try_or_popup!(
673+
self,
674+
"hunk error:",
675+
self.stage_unstage_hunk()
676+
);
677+
667678
Ok(true)
668679
} else if e == self.key_config.status_reset_item
669680
&& !self.is_immutable

0 commit comments

Comments
 (0)