Skip to content
Merged
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
10 changes: 10 additions & 0 deletions src-tauri/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use crate::types::{
};
use crate::utils::normalize_git_path;

const INDEX_SKIP_WORKTREE_FLAG: u16 = 0x4000;

async fn run_git_command(repo_root: &Path, args: &[&str]) -> Result<(), String> {
let output = Command::new("git")
.args(args)
Expand Down Expand Up @@ -354,6 +356,7 @@ pub(crate) async fn get_git_status(
.map_err(|e| e.to_string())?;

let head_tree = repo.head().ok().and_then(|head| head.peel_to_tree().ok());
let index = repo.index().ok();

let mut files = Vec::new();
let mut staged_files = Vec::new();
Expand All @@ -365,6 +368,13 @@ pub(crate) async fn get_git_status(
if path.is_empty() {
continue;
}
if let Some(index) = index.as_ref() {
if let Some(entry) = index.get_path(Path::new(path), 0) {
if entry.flags_extended & INDEX_SKIP_WORKTREE_FLAG != 0 {
continue;
}
}
}
let status = entry.status();
let normalized_path = normalize_git_path(path);
let include_index = status.intersects(
Expand Down
Loading