microsoft / microsoft/vscode-pull-request-github

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

Aperta
#8,928 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
TypeScript
Stelle
2.6k
Fork
796
Merge medio
1g 4h
PR unite (30g)
46

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia da extensions/git/src/git.ts, confrontando getRemotesFS() con getRemotesGit() e verificando come l’analisi della configurazione gestisce le sezioni include e includeIf. Riproduci la configurazione locale al repository fornita, quindi verifica che Repository.state.remotes includa origin e che il comportamento esistente di rilevamento dei remote GitHub funzioni correttamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
git, github, typescript
Ambito
api, developer-experience, tooling
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Attiva
Chiarezza
Specificata chiaramente
Idoneità per principianti
78/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.