mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-30 21:01:54 +08:00
refactor: clarify comments in repo-agent.ts for Git diff handling
- Updated comments in the `applyConfigUpdate` function to enhance clarity regarding the handling of Git diffs and token management. - Removed redundant token redaction logic, ensuring the diff captures the authoritative commit source without alteration. These changes aim to improve code readability and maintainability in the configuration update process.
This commit is contained in:
parent
64b885fb70
commit
9b088a89d5
@ -499,11 +499,13 @@ export async function applyConfigUpdate(options: {
|
||||
// the diff is rebuilt against, and our fast-forward conflict check, at commit time.
|
||||
const baseSha = await gitHead(sandbox);
|
||||
// The diff drives BOTH the review render and the commit (`--no-renames` keeps it to
|
||||
// add/modify/delete; `--cached HEAD` includes newly created files; sanitized for any
|
||||
// stray token, though config diffs never carry one).
|
||||
const diff = redactTokens(
|
||||
(await runRaw(sandbox, "git", ["-c", "core.quotePath=false", "-C", REPO_DIR, "diff", "--cached", "--no-renames", "HEAD"])).stdout,
|
||||
);
|
||||
// add/modify/delete; `--cached HEAD` includes newly created files). Captured VERBATIM:
|
||||
// it is the authoritative commit source, so it must never be altered. The GitHub token
|
||||
// can't appear here anyway — it lives only in `.git/config` (which `git diff` never
|
||||
// reads) and is reset to a tokenless URL before the agent runs, so tracked content
|
||||
// never contains it. (Token scrubbing stays on the error/log paths, where the tokenized
|
||||
// clone URL genuinely can surface.)
|
||||
const diff = (await runRaw(sandbox, "git", ["-c", "core.quotePath=false", "-C", REPO_DIR, "diff", "--cached", "--no-renames", "HEAD"])).stdout;
|
||||
if (diff.trim() === "") {
|
||||
return { mode: "no-change" };
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user