Skip to content

Commit d541d0d

Browse files
author
Stephan Dilly
authored
make fetch more error resilient (#915)
fixing #911
1 parent 5d01da1 commit d541d0d

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
## Fixed
11+
- appropriate error message when pulling deleted remote branch ([#911](https://github.com/extrawurst/gitui/issues/991))
12+
1013
## [0.17.1] - 2021-09-10
1114

1215
**fuzzy find files**

src/app.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ impl App {
385385
self.compare_commits_popup.update_git(ev)?;
386386
self.push_popup.update_git(ev)?;
387387
self.push_tags_popup.update_git(ev)?;
388-
self.pull_popup.update_git(ev)?;
388+
self.pull_popup.update_git(ev);
389389
self.select_branch_popup.update_git(ev)?;
390390
}
391391

@@ -686,7 +686,11 @@ impl App {
686686
flags.insert(NeedsUpdate::ALL);
687687
}
688688
InternalEvent::Pull(branch) => {
689-
self.pull_popup.fetch(branch)?;
689+
if let Err(error) = self.pull_popup.fetch(branch) {
690+
self.queue.push(InternalEvent::ShowErrorMsg(
691+
error.to_string(),
692+
));
693+
}
690694
flags.insert(NeedsUpdate::ALL);
691695
}
692696
InternalEvent::PushTags => {

src/components/pull.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,18 @@ impl PullComponent {
110110
}
111111

112112
///
113-
pub fn update_git(
114-
&mut self,
115-
ev: AsyncGitNotification,
116-
) -> Result<()> {
113+
pub fn update_git(&mut self, ev: AsyncGitNotification) {
117114
if self.is_visible() {
118115
if let AsyncGitNotification::Fetch = ev {
119-
self.update()?;
116+
if let Err(error) = self.update() {
117+
self.pending = false;
118+
self.hide();
119+
self.queue.push(InternalEvent::ShowErrorMsg(
120+
format!("fetch failed:\n{}", error),
121+
));
122+
}
120123
}
121124
}
122-
123-
Ok(())
124125
}
125126

126127
///
@@ -135,11 +136,7 @@ impl PullComponent {
135136
if err.is_empty() {
136137
self.try_ff_merge()?;
137138
} else {
138-
self.pending = false;
139-
self.hide();
140-
self.queue.push(InternalEvent::ShowErrorMsg(
141-
format!("fetch failed:\n{}", err),
142-
));
139+
anyhow::bail!(err);
143140
}
144141
}
145142
}

0 commit comments

Comments
 (0)