microsoft / microsoft/vscode-pull-request-github

Don't fetch every branch in contributor's remote when checking out a pull request

未关闭
#2,030 0 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

feature-request
主要语言
TypeScript
星标
2.6k
派生
796
平均合并
1 天 4 小时
30 天内合并 PR
46

描述

Thanks for this very nice extension!! It is really nice to review code in my code editor:)

I noticed that when I clicked the blue "Checkout" button in the pull request tab, the following happens:

  1. The extension adds a remote named after the GitHub username of the pull-request author (this remote is not deleted when I "Exit review mode")
  2. This new remote is fetched (this creates remote-tracking branches for all branches in the contributor's remote)
  3. The the source branch of the pull request is checked out (this branch is not deleted when I "Exit review mode")

I don't like 2), it pollutes the output of git branch -r.
I think the extension should only fetch the branch of the pull request, i.e.

git fetch $PR_AUTHOR_REMOTE_URL $PR_BRANCH:refs/heads/pr/$AUTHOR_GITHUB_USERNAME/$PR_NUMBER

In fact, adding a remote is not even necessary as Git can fetch a branch directly into FETCH_HEAD, and we can the checkout FETCH_HEADin detached HEAD.

I understand the current behaviour might be convenient for some, but maybe it could be configurable ?

贡献指南

这个仓库没有索引到贡献指南

从这里开始

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

调研方向

从 pull request 标签页的 Checkout 流程开始,跟踪它如何添加 contributor remote、fetch 该 remote,并 checkout source branch。将该行为与 issue 提议的 branch-only fetch 和 detached checkout 进行比较,然后找出现有的 review 模式 checkout 测试;完成的标准是,无关的 contributor branch 不再出现在 git branch -r 中,并且清理仍然有效。

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

评估

技术栈
git, typescript
领域
developer-experience, tooling
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

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