Skip to content

Commit

Permalink
fix test locale and clippy issue
Browse files Browse the repository at this point in the history
Signed-off-by: lxl66566 <[email protected]>
  • Loading branch information
lxl66566 committed Aug 12, 2024
1 parent 2b5cc71 commit d1150c0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot-auto-merger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 1
auto-merge-settings:
merge_level: "patch"
merge_strategy: "rebase"
skip_ci: false
delete_branch: true
commit_title: Auto-merge dependabot PR
commit_message: Auto-merge dependabot PR by @dependabot-auto-merge
skip_check_runs: false
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ updates:
- package-ecosystem: "cargo" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
interval: "monthly"
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![feature(vec_pop_if)]
#![feature(lazy_cell)]
#![feature(let_chains)]
#![warn(clippy::nursery, clippy::cargo)]
#![warn(clippy::nursery, clippy::cargo, clippy::pedantic)]
#![allow(clippy::multiple_crate_versions)]

mod cli;
Expand Down
14 changes: 9 additions & 5 deletions src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,14 @@ impl GitCommand for Repo {
Ok(())
}
fn run_with_output(&self, args: &[&str]) -> Result<String> {
let output = std::process::Command::new("git")
.current_dir(&self.path)
.args(args)
.output()?;
let mut cmd = std::process::Command::new("git");

// we need to check English output in test
if cfg!(test) {
cmd.env("LC_ALL", "C.UTF-8").env("LANGUAGE", "C.UTF-8");
}

let output = cmd.current_dir(&self.path).args(args).output()?;
if !output.status.success() {
return Err(anyhow!(
"Git command failed: {}",
Expand All @@ -173,7 +177,7 @@ impl GitCommand for Repo {
return Ok(vec![]);
}
let files = output_processed
.split(|c| c == '\0')
.split('\0')
.map(|s| s.to_string())
.collect();
debug!("ls-files: {:?}", files);
Expand Down

0 comments on commit d1150c0

Please sign in to comment.