fix(commit_files): avoid panic when async fetch fails

Log fetch and notification errors instead of unwrapping in the
background worker, consistent with revlog and status.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuyangfan 2026-05-17 18:42:15 +08:00
parent 8619c07f3f
commit 2c8b3744ba

View file

@ -108,14 +108,19 @@ impl AsyncCommitFiles {
self.pending.fetch_add(1, Ordering::Relaxed);
rayon_core::spawn(move || {
Self::fetch_helper(&repo, params, &arc_current)
.expect("failed to fetch");
if let Err(e) =
Self::fetch_helper(&repo, params, &arc_current)
{
log::error!("commit_files fetch_helper: {e}");
}
arc_pending.fetch_sub(1, Ordering::Relaxed);
sender
.send(AsyncGitNotification::CommitFiles)
.expect("error sending");
if let Err(e) =
sender.send(AsyncGitNotification::CommitFiles)
{
log::error!("commit_files notify error: {e}");
}
});
Ok(())