Git.commit: --author value is wrapped in literal double quotes, corrupting author names that contain a quote character
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- git, typescript
- 领域
- tooling
调研方向
从 Git.commit 的实现开始,找到组装 --author 参数的位置,然后检查现有的提交相关测试。使用包含双引号的 committer 名称重现问题,移除参数外围的字面引号,并添加一个回归测试,检查 git log -1 --format='%an' 是否保留完整名称。
由索引模型根据 Issue 内容生成。
描述
Observed behavior
Git.commit builds the --author argument with literal double quotes:
args.push(`--author="${committer.name} <${committer.email}>"`);
Because child_process.spawn is used without a shell, the literal " characters are part of the value passed to git. Git's "crud stripping" of identity strings hides the problem for ordinary names (leading/trailing quotes get filtered out), but the protection breaks down if committer.name itself contains a ".
Expected behavior
The literal quotes should not be in the value. The standard format that git documents is just --author=Name <email>, with no surrounding quotes.
Minimal reproduction
await git.commit('msg', {
committer: { name: 'Joe \"Real\"', email: '[email protected]' },
});
// git log -1 --format='%an'
// -> Joe \"Real (the trailing quote is silently lost)
Verified with a standalone Node script that replicates Git.commit's exact spawn arguments. Observed result:
AN=[Joe \"Real] AE=[[email protected]] CN=[Joe \"Real] CE=[[email protected]]
The trailing \" from the source name is gone.
Suggested fix
args.push(`--author=${committer.name} <${committer.email}>`);
A regression test that commits with committer.name = 'Joe \"Real\"' and asserts git log -1 --format='%an' returns Joe \"Real\" would catch this.
- 主要语言
- TypeScript
- 星标
- 2
- 派生
- 1
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
joewalker/loop-the-loop 的其他 Issue
-
bug S4
难度 2/5 1-3 小时 新手友好度 75/100
joewalker/loop-the-loop#88 ·
-
Git exec(): child killed by a signal rejects with new Error('') and loses the signal information未关闭bug S3
难度 2/5 1-3 小时 新手友好度 82/100
joewalker/loop-the-loop#84 ·
-
bug S3
难度 2/5 1-3 小时 新手友好度 76/100
joewalker/loop-the-loop#82 ·
-
bug S4
难度 1/5 1 小时以内 新手友好度 90/100
joewalker/loop-the-loop#79 ·
-
bug S4
难度 1/5 1 小时以内 新手友好度 92/100
joewalker/loop-the-loop#78 ·
查看 joewalker/loop-the-loop 的全部 Issue
相似的 Issue
-
mobile-app
难度 2/5 1-3 小时 新手友好度 74/100
Open-Locker/Open-Locker#352 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
leanprover-community/lean4game#589 ·
维护者通常 2 天内回复
-
check:passed streams:add
难度 1/5 1 小时以内 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
维护者通常 1 天内回复