Repository navigation
fix(线): merge/sync/task merge --push 钉住分支 tip 推送 - #83
Merged
Merged
Conversation
此前三条 --push 路径执行裸 git push origin <branch>,锚点取推送后 的 HEAD。push.default=upstream 且上游指向别的远端分支时会推到错误 分支(git 2.49 实测 feat -> main),推送后工作区被切走时锚点也会 与实际推送不一致。 现在推送前钉住 refs/heads/<branch> 的 tip,执行 git push origin <tip>:refs/heads/<branch>,锚点和 journal 都记这个 SHA;预检、--recover 手动命令、建线发布提示与推送说明也不再给出 裸 git push origin <分支>。dyro line push 不变。
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Merged
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
line sync --push、line merge --into --push与task merge --push原来执行的是不带目标的git push origin <branch>,远端锚点取推送之后的HEAD。会出两类问题:push.default=upstream且分支上游指向别的远端分支时(例如origin/main),git push origin <branch>会推到那个上游分支。在 git 2.49 上实测:git push origin feat输出feat -> main,远端 main 被改写,Dyro 却仍然写入了锚点。dyro line push已在 #81 修好同类问题,这里修复其余三条路径。改动
rev-parse --verify refs/heads/<branch>。git push origin <tip>:refs/heads/<branch>。不带-u,也不用任何 force 写法。不管push.default和上游怎么配置,也不管推送期间分支是否移动,远端更新的都恰好是refs/heads/<branch>,内容也恰好是这个 tip。target_sha和 resultnew_tip也都用它。git push --dry-run origin refs/heads/<b>:refs/heads/<b>。git push origin <分支>,同样可能推错分支,现在都不再这样写:--recover打印的手动推送命令,改为显式 refspec;dyro line push,或显式 refspec 的git push -u;PUSH_DISABLED_NOTE,改为“逐仓推送该分支的 tip”。这段文案的三处副本保持逐字一致,技能资产 8165 字节,仍在 8 KiB 上限内。dyro line push不变:它需要-u来纠正上游,而-u要求推送源是分支名,所以继续用refs/heads/<b>:refs/heads/<b>,并在推送前后各核对一次 tip。升级影响
推送说明文案又改了一次。0.7.19 还没有发布,所以对用户来说仍然只需要在升级后运行一次
dyro host seed --force。验证
tests/test_merge_push_refspec.py:三条路径各一个“上游误配”用例,断言远端 main 不变、远端线分支等于锚点;另有一个竞态用例,在推送前往分支追加一个提交,断言远端和锚点仍然是钉住的那个 tip。ruff check src tests experiments无问题。残余风险(未修改)
new_tip比对。如果锁外有人在合并之后、推送之前推进了分支,那些提交会被一起推上去。锚点仍然等于实际推送的提交。result_head仍然读 HEAD,只在同一个锁外窗口里才会和锚点不一致。