You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
概要
merged PRを
gh pr checkoutしてレビューを開始すると、merge-base(base branch, HEAD)がPRの分岐点にならず、previewとgitsignsの差分が崩れていた。GitHubが記録しているPRのbase commit(base.sha)も使って分岐点を求めるようにし、merged PRでもPR当時の差分を見られるようにする。#238(previewのmerge-base化)の上にstackしている。変更内容
baseRefOid(PRのbase commit)を受け取り、state.base_shaに保存する(lua/fude/gh.lua、lua/fude/init.lua、lua/fude/config.lua)gh pr view --jsonにbaseRefOidを追加し、detached HEAD経路のparse_pr_from_commit_apiではbase.shaを同じ名前で返すbase.shaはmerge直前のbase branch先端で固定される。feat: 複数行コメントの対象範囲を表示する #237、feat: ローカルレビューとレビュー本文で書きかけのコメントを下書き保存できるようにする #236、#234で、merge commitの親と一致することを確認したcompute_merge_baseは、base.sha起点とbase_ref起点の2つのmerge-baseから分岐点を選ぶ(純粋関数find_fork_point)base_ref起点のmerge-baseはHEAD自身になる(差分がゼロになる)。この場合はbase.sha起点を使うgit merge-base --is-ancestorで判定)を使う。open PRでは、base branchをPRにmergeした後もGitHubのbase.shaが古いままのことがあり、逆にローカルのbase branchが古いこともあるため、片方に固定すると分岐点が古くなるbase.shaのcommitがローカルに無い(未fetch)場合は、従来どおりbase_ref起点だけを使う。compute_merge_baseは同期処理なので、ここではgit fetchしないapply_gitsigns_base_for_buffer)added)をmerge-baseとの比較で判定するので、merge-baseにはそのファイルが存在しない。一方、base branchの先端はmerged PRだとそのファイルを含むため、hunkが出なくなっていたis_new_fileを削除したテスト計画
make all)tests/fude/init_integration_spec.lua(find_fork_pointの各ケース、compute_merge_baseの候補とフォールバック、base_shaの保存、新規ファイルのgitsigns基準)、tests/fude/gh_spec.lua(baseRefOidの取得とJSON null)、tests/fude/diff_spec.lua(is_ancestor)merge-base(main, HEAD)がHEAD自身になり、merge-base(base.sha, HEAD)が分岐点になることを確認した備考
N/A
Generated with Claude Code