github / github/gh-stack

Various issues exhibited when local and remote base branch names are not the same

未關閉
#219 0 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
bug topic: cli - submit
主要語言
Go
星號
1.5k
分支
70
平均合併
1 天 8 小時
30 天內合併 PR
7

描述

Due to having a single repo with many different forks of LLVM checked out into various worktrees, my local branch names for things like "main" are often prefixed; e.g. my local branch that tracks llvm/llvm-project is upstream-main. For most operations this seems to work fine, I could gh stack init --base upstream-main and create my stack locally. However, when it came time to submit, I got the following:

```
% gh stack submit --auto --open
Checking stack state...
? Multiple remotes found. Which remote should be used? upstream
? Save "upstream" as the default remote for all gh stack operations? No
Pushing to upstream...
⚠ failed to create PR for users/jrtc27/lld-test-aarch64-ifunc-bti: creating PR: GraphQL: Head sha can't be blank, Base sha can't be blank, No commits between upstream-main and users/jrtc27/lld-test-aarch64-ifunc-bti, Base ref must be a branch (createPullRequest)
✓ Created PR #210611 for users/jrtc27/lld-test-ppc32-ifunc-nonpreemptible
✓ Created PR #210612 for users/jrtc27/lld-replaceWithDefined-skip-copy
✓ Created PR #210613 for users/jrtc27/lld-handleNonPreemptibleIfunc-skip-pointless-alias
✓ Created PR #210614 for users/jrtc27/lld-handleNonPreemptibleIfunc-no-copy-constructor
✓ Created PR #210615 for users/jrtc27/lld-Symbol-remove-copy-constructor
✓ Created PR #210616 for users/jrtc27/lld-handleNonPreemptibleIfunc-addSyntheticLocal
✓ Stack created on GitHub with 6 PRs (stack #210617)
✓ Pushed and synced 7 branches
```

There are three issues here:

1. gh-stack should have been able to figure out that, given upstream-main is the base branch tracking refs/remotes/upstream/main, upstream is the sensible remote to automatically use (but that's a minor nice-to-have)
2. gh-stack should be querying the upstream branch for the base branch and using that as the branch name (minus the refs/remotes prefix), not the local branch (presumably only falling back to the local branch name if there is no upstream branch, if that's a sensible thing to do)
3. If creating a PR fails, gh-stack should stop before it makes things worse, as fixing this up manually is a bit of a pain (you have to create the missing PR, unstack the existing stack and only then can you re-stack the entire thing, since gh stack link currently doesn't let you add to the front of the stack, presumably due to the API being a bit deficient...)

貢獻指南

開啟貢獻指南

研究方向

從 gh stack submit --auto --open 流程開始,追蹤在建立 pull request 之前如何選擇本機分支、upstream 追蹤 refs 和 remotes。重現回報的 upstream-main 情況,並驗證傳送至 GitHub 的基底分支、remote 選擇,以及建立 PR 失敗後的行為。完成的標準是解決回報的全部三個問題,且不留下部分提交的 stack。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
git, github, go
領域
cli
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。