mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Warn when trusting Git subdirectories (#18602)
Addresses #18505 ## Summary When Codex is launched from a subdirectory of a Git repository, the onboarding trust prompt says it is trusting the current directory even though the persisted trust target is the repository root. That can make the scope of the trust decision unclear. This updates the TUI trust prompt to show a yellow note only when the current directory differs from the resolved trust target, explaining that trust applies to the repository root and displaying that root. It also removes the stale onboarding TODO now that the warning is implemented.
This commit is contained in:
committed by
GitHub
Unverified
parent
33fa952426
commit
216e7a0a56
@@ -139,7 +139,6 @@ impl OnboardingScreen {
|
||||
error: None,
|
||||
}))
|
||||
}
|
||||
// TODO: add git warning.
|
||||
Self {
|
||||
request_frame: tui.frame_requester(),
|
||||
steps,
|
||||
|
||||
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user