Merge pull request #4174 from gitbutlerapp/cool-with-submodules

cool with submodules
This commit is contained in:
Kiril Videlov 2024-06-25 13:35:05 +02:00 committed by GitHub
commit e707bdd812
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,5 @@
use anyhow::{anyhow, bail, Context};
use git2::FileMode;
use git2::{DiffOptions, FileMode};
use std::collections::HashMap;
use std::path::Path;
use std::str::{from_utf8, FromStr};
@ -301,7 +301,11 @@ impl Project {
.or_insert_with(|| tree_from_applied_vbranches(&repo, parent.id()).unwrap());
let parent_tree = repo.find_tree(parent_wd_tree_id.to_owned())?;
let diff = repo.diff_tree_to_tree(Some(&parent_tree), Some(&wd_tree), None)?;
let mut opts = DiffOptions::new();
opts.include_untracked(true);
opts.ignore_submodules(true);
let diff =
repo.diff_tree_to_tree(Some(&parent_tree), Some(&wd_tree), Some(&mut opts))?;
let mut files_changed = Vec::new();
diff.print(git2::DiffFormat::NameOnly, |delta, _, _| {

View File

@ -72,9 +72,6 @@ impl Controller {
bail!("can only work in main worktrees");
};
}
Ok(repo) if repo.submodules().map_or(false, |sm| sm.is_some()) => {
bail!("repositories with git submodules are not supported");
}
Ok(_repo) => {}
Err(err) => {
return Err(anyhow::Error::from(err))