Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Warn when trusting Git subdirectories (#18602)

Eric Traut216e7a0a567c
diff --git a/codex-rs/tui/src/onboarding/onboarding_screen.rs b/codex-rs/tui/src/onboarding/onboarding_screen.rs
index c30ee500a8..0c7ebda080 100644
--- a/codex-rs/tui/src/onboarding/onboarding_screen.rs
+++ b/codex-rs/tui/src/onboarding/onboarding_screen.rs
@@ -139,7 +139,6 @@ impl OnboardingScreen {
error: None,
}))
}
- // TODO: add git warning.
Self {
request_frame: tui.frame_requester(),
steps,
diff --git a/codex-rs/tui/src/onboarding/trust_directory.rs b/codex-rs/tui/src/onboarding/trust_directory.rs
index f04e9f9af9..5a1626fda4 100644
--- a/codex-rs/tui/src/onboarding/trust_directory.rs
+++ b/codex-rs/tui/src/onboarding/trust_directory.rs
@@ -51,6 +51,23 @@ impl WidgetRef for &TrustDirectoryWidget {
]));
column.push("");
+ if self.cwd != self.trust_target {
+ #[allow(clippy::disallowed_methods)]
+ let git_root_warning = Paragraph::new(format!(
+ "Note: You’re in a subdirectory of a Git project. Trusting will apply to the repository root: {}",
+ self.trust_target.display()
+ ))
+ .yellow();
+ column.push(
+ git_root_warning
+ .wrap(Wrap { trim: true })
+ .inset(Insets::tlbr(
+ /*top*/ 0, /*left*/ 2, /*bottom*/ 0, /*right*/ 0,
+ )),
+ );
+ column.push("");
+ }
+
column.push(
Paragraph::new(
"Do you trust the contents of this directory? Working with untrusted \