Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support options in git_status.fetch() #2287

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions src/tabs/stashing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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::Both
} else {
StatusType::WorkingDir
};
let show_untracked = if self.options.stash_untracked {
Some(ShowUntrackedFilesConfig::All)
} else {
Some(ShowUntrackedFilesConfig::No)
};
self.git_status.fetch(&StatusParams::new(
status_type,
show_untracked,
))?;
}

Ok(())
Expand Down