check: during an uncommitted merge, ratchets blame main's new code on the branch (diff base ignores MERGE_HEAD)

未关闭
#537 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
git, typescript
领域
devtools

调研方向

Start with scripts/lib/base.ts and trace how it selects the diff base during an in-progress merge or rebase. Add coverage using a temporary Git repository with an uncommitted merge, then run the relevant i18n:check tests or command. Done when upstream strings are excluded while strings added on the branch are still reported.

由索引模型根据 Issue 内容生成。

描述

area: ci type: bug

What

bun run i18n:check run in the middle of a merge (conflicts resolved, merge not yet committed) reports main's own new strings as "new in this change". Seen on #526 after merging origin/main (which had #534 and #532): 2 hardcoded-text errors in GitSettings.svelte and 3 writing-lint errors in docs/contributing.md, in files identical to origin/main. After git commit the same check is clean.

Why

scripts/lib/base.ts resolves the diff base as merge-base(HEAD, origin/main). During an uncommitted merge HEAD is still the pre-merge branch tip, so the base is the old fork point while the working tree already holds main's changes.

Fix

When .git/MERGE_HEAD exists (or git rev-parse -q --verify MERGE_HEAD succeeds), use merge-base(MERGE_HEAD, origin/main) together with the branch side, i.e. the base is the newer of the two fork points: with MERGE_HEAD == origin/main that is origin/main itself. Same for a rebase in progress (REBASE_HEAD/.git/rebase-merge/onto). Test with a real repo: main adds a hardcoded string, branch merges main without committing, the ratchet reports nothing; the branch's own new string is still reported.

Agents resolve merges constantly; this sends them chasing errors in code they never touched.

主要语言
Rust
星标
3
派生
1
平均合并
9 小时 51 分钟
30 天内合并 PR
310

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codeatlasdev/atlas 的其他 Issue

查看 codeatlasdev/atlas 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。