diff --git a/CHANGELOG.md b/CHANGELOG.md index 989e93276c..7ac8224c06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +## Fixed +- appropriate error message when pulling deleted remote branch ([#911](https://github.com/extrawurst/gitui/issues/991)) + ## [0.17.1] - 2021-09-10 **fuzzy find files** diff --git a/src/app.rs b/src/app.rs index c0d0db9efe..c47ed3bc11 100644 --- a/src/app.rs +++ b/src/app.rs @@ -385,7 +385,7 @@ impl App { self.compare_commits_popup.update_git(ev)?; self.push_popup.update_git(ev)?; self.push_tags_popup.update_git(ev)?; - self.pull_popup.update_git(ev)?; + self.pull_popup.update_git(ev); self.select_branch_popup.update_git(ev)?; } @@ -686,7 +686,11 @@ impl App { flags.insert(NeedsUpdate::ALL); } InternalEvent::Pull(branch) => { - self.pull_popup.fetch(branch)?; + if let Err(error) = self.pull_popup.fetch(branch) { + self.queue.push(InternalEvent::ShowErrorMsg( + error.to_string(), + )); + } flags.insert(NeedsUpdate::ALL); } InternalEvent::PushTags => { diff --git a/src/components/pull.rs b/src/components/pull.rs index 05b1b7a716..05d4c84fb2 100644 --- a/src/components/pull.rs +++ b/src/components/pull.rs @@ -110,17 +110,18 @@ impl PullComponent { } /// - pub fn update_git( - &mut self, - ev: AsyncGitNotification, - ) -> Result<()> { + pub fn update_git(&mut self, ev: AsyncGitNotification) { if self.is_visible() { if let AsyncGitNotification::Fetch = ev { - self.update()?; + if let Err(error) = self.update() { + self.pending = false; + self.hide(); + self.queue.push(InternalEvent::ShowErrorMsg( + format!("fetch failed:\n{}", error), + )); + } } } - - Ok(()) } /// @@ -135,11 +136,7 @@ impl PullComponent { if err.is_empty() { self.try_ff_merge()?; } else { - self.pending = false; - self.hide(); - self.queue.push(InternalEvent::ShowErrorMsg( - format!("fetch failed:\n{}", err), - )); + anyhow::bail!(err); } } }