From 8c4bc0409f220bff257cb0529c1cf9b2dc8c5868 Mon Sep 17 00:00:00 2001 From: Kaniel Kirby Date: Fri, 5 Jul 2024 19:32:43 -0500 Subject: [PATCH 1/2] Support `options` in `git_status.fetch()` It looks like support was available/built-in, but possibly left out for some reason? Happy to rework, this is just to start conversations :) --- src/tabs/stashing.rs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/tabs/stashing.rs b/src/tabs/stashing.rs index 7afe6ae3f5..302ffc90c4 100644 --- a/src/tabs/stashing.rs +++ b/src/tabs/stashing.rs @@ -13,7 +13,10 @@ use crate::{ }; use anyhow::Result; use asyncgit::{ - sync::{self, status::StatusType, RepoPathRef}, + sync::{ + self, status::StatusType, RepoPathRef, + ShowUntrackedFilesConfig, + }, AsyncGitNotification, AsyncStatus, StatusParams, }; use crossterm::event::Event; @@ -71,9 +74,20 @@ impl Stashing { /// pub fn update(&mut self) -> Result<()> { if self.is_visible() { - self.git_status - //TODO: support options - .fetch(&StatusParams::new(StatusType::Both, None))?; + let status_type = if self.options.keep_index { + StatusType::WorkingDir + } else { + StatusType::Both + }; + let show_untracked = if self.options.stash_untracked { + Some(ShowUntrackedFilesConfig::No) + } else { + Some(ShowUntrackedFilesConfig::All) + }; + self.git_status.fetch(&StatusParams::new( + status_type, + show_untracked, + ))?; } Ok(()) From e7e1bc17f981a224f646c79a14c602dc2bb78570 Mon Sep 17 00:00:00 2001 From: Kaniel Kirby Date: Fri, 5 Jul 2024 19:42:46 -0500 Subject: [PATCH 2/2] Fix reversed booleans in stashing update fn --- src/tabs/stashing.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tabs/stashing.rs b/src/tabs/stashing.rs index 302ffc90c4..d32cbe3783 100644 --- a/src/tabs/stashing.rs +++ b/src/tabs/stashing.rs @@ -75,14 +75,14 @@ impl Stashing { pub fn update(&mut self) -> Result<()> { if self.is_visible() { let status_type = if self.options.keep_index { - StatusType::WorkingDir - } else { StatusType::Both + } else { + StatusType::WorkingDir }; let show_untracked = if self.options.stash_untracked { - Some(ShowUntrackedFilesConfig::No) - } else { Some(ShowUntrackedFilesConfig::All) + } else { + Some(ShowUntrackedFilesConfig::No) }; self.git_status.fetch(&StatusParams::new( status_type,