mirror of
https://github.com/openai/codex.git
synced 2026-10-30 19:18:49 +00:00
test(git-utils): fix cross-platform status guard lints
This commit is contained in:
@@ -199,7 +199,7 @@ impl GitRunner {
|
||||
|
||||
/// Spawn a configured Tokio command after applying the final
|
||||
/// repository-selector environment lock.
|
||||
#[cfg(test)]
|
||||
#[cfg(all(test, unix))]
|
||||
pub(crate) async fn output_async(
|
||||
&self,
|
||||
mut command: GitAsyncCommand,
|
||||
|
||||
@@ -41,7 +41,7 @@ async fn bounded_async_output_rejects_the_first_byte_over_limit() {
|
||||
let write = tokio::spawn(async move {
|
||||
writer.write_all(b"12345").await.expect("write fixture");
|
||||
});
|
||||
let error = read_bounded_output(reader, 4)
|
||||
let error = read_bounded_output(reader, /*max_bytes*/ 4)
|
||||
.await
|
||||
.expect_err("fifth byte must exceed limit");
|
||||
write.await.expect("join fixture writer");
|
||||
|
||||
@@ -34,7 +34,7 @@ impl IncludeGraphBudget {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(all(test, unix))]
|
||||
pub(super) fn with_limit(limit: usize) -> Self {
|
||||
Self {
|
||||
remaining_directives: limit,
|
||||
|
||||
@@ -1538,7 +1538,7 @@ async fn async_include_budget_stops_before_over_limit_expansion_launch() {
|
||||
})
|
||||
.collect();
|
||||
let mut pending = Vec::new();
|
||||
let mut budget = IncludeGraphBudget::with_limit(2);
|
||||
let mut budget = IncludeGraphBudget::with_limit(/*limit*/ 2);
|
||||
|
||||
let error = validate_include_entries_async(
|
||||
&git,
|
||||
|
||||
@@ -6,8 +6,11 @@ use crate::get_has_changes;
|
||||
use crate::git_config::GitConfigScope;
|
||||
#[cfg(unix)]
|
||||
use crate::patch_paths::stage_paths;
|
||||
#[cfg(unix)]
|
||||
use crate::status_guard::git_root_from_stdout;
|
||||
#[cfg(unix)]
|
||||
use crate::status_guard::prepare_status_filter_guard;
|
||||
#[cfg(unix)]
|
||||
use crate::status_guard::resolve_git_root_async;
|
||||
use crate::try_get_has_changes;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Stdio;
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(all(test, unix))]
|
||||
use tokio::time::timeout;
|
||||
|
||||
use crate::GitReadError;
|
||||
@@ -16,7 +16,7 @@ use crate::git_command::MAX_INTERNAL_GIT_OUTPUT_BYTES;
|
||||
use crate::repository_authority::is_authority_refusal;
|
||||
use crate::safe_git::DISABLED_HOOKS_PATH;
|
||||
use crate::safe_git::FilterAttributeValue;
|
||||
#[cfg(test)]
|
||||
#[cfg(all(test, unix))]
|
||||
use crate::safe_git::GIT_COMMAND_TIMEOUT;
|
||||
use crate::safe_git::GitFilterNeutralization;
|
||||
use crate::safe_git::SelectedFilterPolicy;
|
||||
@@ -35,7 +35,7 @@ use crate::safe_git::write_nul_paths;
|
||||
|
||||
const MAX_STATUS_TRACKED_PATHS: usize = 250_000;
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(all(test, unix))]
|
||||
pub(crate) async fn prepare_status_filter_guard(
|
||||
git: &GitRunner,
|
||||
cwd: &Path,
|
||||
|
||||
@@ -101,7 +101,7 @@ fn io_error_mapping_preserves_authority_provenance() {
|
||||
#[tokio::test]
|
||||
async fn dropping_status_preparation_kills_the_active_git_child() {
|
||||
let temp_dir = tempfile::tempdir().expect("create temp dir");
|
||||
let repo = init_repo(&temp_dir, 0).await;
|
||||
let repo = init_repo(&temp_dir, /*file_count*/ 0).await;
|
||||
let wrapper = temp_dir.path().join("git-wrapper");
|
||||
let pid_file = wrapper.with_extension("pid");
|
||||
let blocker = wrapper.with_extension("block");
|
||||
@@ -181,7 +181,7 @@ async fn filter_marker_is_set(repo: &Path, key: &str) -> bool {
|
||||
#[tokio::test]
|
||||
async fn prepared_guard_neutralizes_filter_selected_after_the_probe() {
|
||||
let temp_dir = tempfile::tempdir().expect("create temp dir");
|
||||
let repo = init_repo(&temp_dir, 0).await;
|
||||
let repo = init_repo(&temp_dir, /*file_count*/ 0).await;
|
||||
run_git(
|
||||
&repo,
|
||||
&[
|
||||
@@ -216,7 +216,7 @@ async fn prepared_guard_neutralizes_filter_selected_after_the_probe() {
|
||||
#[tokio::test]
|
||||
async fn optional_smudge_only_filter_is_allowed_but_required_is_refused() {
|
||||
let temp_dir = tempfile::tempdir().expect("create temp dir");
|
||||
let repo = init_repo(&temp_dir, 0).await;
|
||||
let repo = init_repo(&temp_dir, /*file_count*/ 0).await;
|
||||
std::fs::write(repo.join(".gitattributes"), "test.txt filter=smudge-only\n")
|
||||
.expect("select smudge filter");
|
||||
run_git(&repo, &["add", ".gitattributes"]).await;
|
||||
@@ -251,7 +251,7 @@ async fn optional_smudge_only_filter_is_allowed_but_required_is_refused() {
|
||||
#[tokio::test]
|
||||
async fn optional_smudge_required_value_is_queried_once_per_driver() {
|
||||
let temp_dir = tempfile::tempdir().expect("create temp dir");
|
||||
let repo = init_repo(&temp_dir, 2).await;
|
||||
let repo = init_repo(&temp_dir, /*file_count*/ 2).await;
|
||||
std::fs::write(
|
||||
repo.join(".gitattributes"),
|
||||
"file-0.txt filter=smudge-only\nfile-1.txt filter=smudge-only\n",
|
||||
@@ -296,7 +296,7 @@ async fn optional_smudge_required_value_is_queried_once_per_driver() {
|
||||
#[tokio::test]
|
||||
async fn sentinel_probe_neutralizes_a_race_selected_known_driver() {
|
||||
let temp_dir = tempfile::tempdir().expect("create temp dir");
|
||||
let repo = init_repo(&temp_dir, 0).await;
|
||||
let repo = init_repo(&temp_dir, /*file_count*/ 0).await;
|
||||
std::fs::write(repo.join(".gitattributes"), "test.txt filter\n")
|
||||
.expect("write sentinel attribute");
|
||||
run_git(&repo, &["add", ".gitattributes"]).await;
|
||||
@@ -379,7 +379,7 @@ async fn sentinel_probe_budget_fails_closed_at_the_exact_process_limit() {
|
||||
#[tokio::test]
|
||||
async fn ordinary_driver_uses_one_bulk_path_and_attribute_probe() {
|
||||
let temp_dir = tempfile::tempdir().expect("create temp dir");
|
||||
let repo = init_repo(&temp_dir, 24).await;
|
||||
let repo = init_repo(&temp_dir, /*file_count*/ 24).await;
|
||||
run_git(
|
||||
&repo,
|
||||
&[
|
||||
|
||||
Reference in New Issue
Block a user