Skip to content

Commit

Permalink
Fix StagedOnly
Browse files Browse the repository at this point in the history
Needed the files to be modified
  • Loading branch information
c-git committed Nov 5, 2023
1 parent 508f0e3 commit 377dd71
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use anyhow::bail;
use cargo_util::paths;
use std::fmt::Debug;
use std::fs;
use std::fs::File;
use std::io::Write;
use std::path::Path;
use std::path::PathBuf;
use strum::EnumIter;
Expand Down Expand Up @@ -132,7 +134,7 @@ pub fn create_test_folder(test_dir: &TestDir) -> anyhow::Result<()> {
create_abc(&path)?;
git_commands::add_all(&repo, &["a", "b", "c"])?;
git_commands::commit_irrelevant_msg(&repo)?;
// modify_files(&["b", "c"])?;
modify_files(&path, &["b", "c"])?;
git_commands::add_all(&repo, &["b", "c"])?;
}
TestDir::DirtyOnly => todo!(),
Expand All @@ -149,3 +151,16 @@ fn create_abc<P: AsRef<Path>>(path: P) -> anyhow::Result<()> {
}
Ok(())
}

fn modify_files<P: AsRef<Path>>(path: P, files: &[&str]) -> anyhow::Result<()> {
let path = path.as_ref();
for name in files {
let file_name = path.join(name);
let mut file = fs::OpenOptions::new()
.write(true)
.create(true)
.open(file_name)?;
file.write_all(b"Some text\n")?;
}
Ok(())
}

0 comments on commit 377dd71

Please sign in to comment.