microsoft / microsoft/vscode-pull-request-github

Git API omits remotes defined through repository-local include.path

オープン
#8,928 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
2.6k
フォーク
796
平均マージ
1日 4時間
マージ済み PR(30日)
46

説明

Type: Bug

Does this issue occur when all extensions are disabled?: Yes

When remotes are defined via an include inside .git/config, they are not correctly parsed. The most visible error is via the GitHub Pull Requests extension that shows [error] [FolderRepositoryManager+0] The remote 'origin' is not a GitHub repository. even though it really is.

Steps to Reproduce:

  1. Create a repository whose remote is defined in an included config:

    root="$(mktemp -d)"
    git init "$root/repo"
    
    git config --file "$root/remotes.conf" \
      remote.origin.url https://github.com/microsoft/vscode.git
    git config --file "$root/remotes.conf" \
      remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
    
    git -C "$root/repo" config --local include.path "$root/remotes.conf"
    git -C "$root/repo" remote -v
    
  2. Confirm that Git reports origin:

    origin https://github.com/microsoft/vscode.git (fetch)
    origin https://github.com/microsoft/vscode.git (push)
    
  3. Open $root/repo in VS Code.

  4. Inspect the built-in Git extension’s Repository.state.remotes.

Actual behavior:

Repository.state.remotes does not contain origin. Features consuming the Git API consequently behave as if the repository has no matching remote, even though Git resolves it correctly.

Expected behavior:

Repository.state.remotes should reflect Git’s effective configuration, including remotes supplied through [include] and applicable [includeIf] sections.

Root cause:

extensions/git/src/git.ts implements getRemotesFS() by reading and parsing .git/config directly:

private async getRemotesFS(): Promise<MutableRemote[]> {
  const raw = await fs.readFile(
    path.join(this.dotGit.commonPath ?? this.dotGit.path, 'config'),
    'utf8'
  );
  return parseGitRemotes(raw);
}

This bypasses Git’s include processing. The existing getRemotesGit() fallback is only used when direct parsing throws, not when parsing succeeds but returns an incomplete set of remotes.

Suggested fix:

When the local config contains an include or includeIf section, use getRemotesGit() so Git resolves the effective configuration. This preserves the fast direct-file path for repositories without includes.

Extension version: 0.132.2
VS Code version: Code 1.136.1 (Universal) (a44adf7f53e00964ab890f9f8758a334f1fc15bc, 2026-09-03T05:06:41Z)
OS version: Darwin arm64 25.6.0
Modes:
Remote OS version: Linux x64 5.4.0-1161-aws-fips

System Info
Item Value
CPUs Apple M4 Max (16 x 2400)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x106b [Google Inc. (Apple)], DEVICE=0x0000 [ANGLE (Apple, ANGLE Metal Renderer: Apple M4 Max, Version 26.6.2 (Build 25G83))], DRIVER_VENDOR=Apple, DRIVER_VERSION=26.6.2 ACTIVE
Machine model name: Mac
Machine model version: 16.5
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: enabled_on
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 3, 3, 3
Memory (System) 64.00GB (0.45GB free)
Process Argv --crash-reporter-id d815658b-4870-4f52-91e0-a84e1b9dc813
Screen Reader no
VM 0%
Item Value
Remote SSH: arca.ssh
OS Linux x64 5.4.0-1161-aws-fips
CPUs Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz (48 x 0)
Memory (System) 371.78GB (339.97GB free)
VM 0%
A/B Experiments
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
envsactivate1:31551504
478i5457:31544283
cloudbuttont:31379625
3efgi100_wstrepl:31403338
ddidt:31399633
ec5jj548:31422691
cp_cls_t_966_ss:31526232
4je02754:31572277
8hhj4413:31478653
cp_cls_c_1081:31454833
conptydll_true:31498968
e9c30283:31461165
c9b86496:31447327
ei9d7968:31496641
chat:31457767
8hig5102:31480529
89g7j272:31518289
i2gc6536:31499202
52612955:31516516
h08i8180:31475369
ddid_t:31478206
hmra_i5g22:31518061
7df3h592:31512476
cp_cls_t_1082:31535311
logging_enabled_new:31498466
j0d79568:31499440
jb_cp_cls_t_632:31543129
748c7209:31512887
32d76977:31512328
ha629193:31508444
a1ije391_t:31540920
jbcp_cls_pctr_t:31531130
cp_intellij_t_nes:31548657
jf4hg949:31526829
ahp-both-windows:31556933
ihg5j128:31534457
7g2b5551:31542111
sandbox-ui-on-2:31543161
nes-ex-cf-euporie-03:31542868
enable_editor_pane_layout:31569726
allow-none:31555437
36h42362:31564511
c7c27ce7:31554789
1h923230:31564177
1532g621_copy:31554320
treatment-23-1:31555779
unuse_dynamic_mcp:31555281
0d8dfbc3:31570291
nemo-v2:31565334
0c1h4866:31566224
session-mark-done:31558131
5b8j3302:31564601
mangle-name-control:31572633
multiv2:31574985
2bfb8b39:31576696
permission_prompt_treatment:1332566
ccr_pr_nudge_adoption:1319471
vsc_wsm_t:1340632
jidc7660:1370295
auto_mode_control:1367906

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

extensions/git/src/git.ts から始め、getRemotesFS() と getRemotesGit() を比較し、設定の解析が include セクションと includeIf セクションをどのように処理するかを確認します。提供されたリポジトリローカルの設定を再現し、その後、Repository.state.remotes に origin が含まれていること、および既存の GitHub リモート検出動作が正しく機能することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
git, github, typescript
領域
api, developer-experience, tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
78/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。