From 4b56a636ff343336a250ab20b0c14df7f3fea6d9 Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Sun, 27 Sep 2020 19:11:03 +0200 Subject: [PATCH] fix crash interfering of other git processes (closes #271) --- CHANGELOG.md | 3 +++ asyncgit/src/status.rs | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b074b6a..c2f7b098 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ![tree](assets/compact-tree.png) +### Fixed +- crash when changing git repo while gitui is open ([#271](https://github.com/extrawurst/gitui/issues/271)) + ## [0.10.1] - 2020-09-01 ### Fixed diff --git a/asyncgit/src/status.rs b/asyncgit/src/status.rs index 75ffb69d..be37d35c 100644 --- a/asyncgit/src/status.rs +++ b/asyncgit/src/status.rs @@ -120,20 +120,22 @@ impl AsyncStatus { self.pending.fetch_add(1, Ordering::Relaxed); rayon_core::spawn(move || { - Self::fetch_helper( + let ok = Self::fetch_helper( status_type, include_untracked, hash_request, arc_current, arc_last, ) - .expect("failed to fetch status"); + .is_ok(); arc_pending.fetch_sub(1, Ordering::Relaxed); - sender - .send(AsyncNotification::Status) - .expect("error sending status"); + if ok { + sender + .send(AsyncNotification::Status) + .expect("error sending status"); + } }); Ok(None)