← 输入框|github.com|刷新
Skip to content

Batch Git config reads for branch operations - #8978

Merged
Alex Ross (alexr00) merged 4 commits into
microsoft:mainfrom
tamird:perf/local-pr-config-snapshot
Oct 29, 2026
Merged

Alex Ross (alexr00) merged 4 commits into
microsoft:mainfrom
tamird:perf/local-pr-config-snapshot

Conversation

@tamird

@tamird Tamir Duberstein (tamird) commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Local pull request discovery reads the complete Git configuration separately for every local branch. Reading one snapshot and indexing the requested branches reduces this from N config reads to one: for 102 branches, 102 reads become 1, eliminating 101 reads (about 99%). The config entries are scanned once instead of once per branch.

Use the same batch lookup for first-activation association, reducing metadata reads from up to 10 to 1. Branch deletion reads config once after the deletion batch and refreshes it only when fallback deletions were needed, replacing the per-branch reads while preserving cleanup of leftover settings. Match the full branch section so deleting feature preserves settings for feature.preview.

Remove the single-branch metadata API and migrate its callers to the batch API. Keep the Map for branch lookup and presence checks, preserve the highest PR number and the first entry on ties, and retain the regression covering reuse across branch chunks and fresh data on the next refresh.

Copilot AI lite review requested due to automatic review settings September 22, 2026 02:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved review issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Optimizes local pull request refreshes by reading repository configuration once per refresh.

Changes:

  • Adds batch metadata lookup for multiple branches.
  • Reuses one configuration snapshot across branch chunks.
  • Expands tests for batching, refresh behavior, and failures.
File Description
src/​test/​github/​pullRequestGitHelper.test.ts Expands duplicate metadata coverage.
src/​test/​github/​folderRepositoryManager.test.ts Tests configuration snapshot behavior.
src/​github/​pullRequestGitHelper.ts Implements batch metadata lookup.
src/​github/​folderRepositoryManager.ts Reuses metadata during local PR discovery.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@tamird Tamir Duberstein (tamird) changed the title Read local PR config once per refresh Batch Git config reads for branch operations Sep 22, 2026
Copilot AI review requested due to automatic review settings September 22, 2026 02:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved blocking issues were identified.

Review effort: Lite
Findings: None

@alexr00 Alex Ross (alexr00) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable, thank you! One question, and there are conflicts.

Comment thread src/github/folderRepositoryManager.ts Resolved
Copilot AI lite review requested due to automatic review settings September 30, 2026 00:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved blocking issues were identified.

Review effort: Lite
Findings: None

@alexr00 Alex Ross (alexr00) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tamir Duberstein (@tamird), just for the future: it's hard to re-review PRs that are force pushed. Instead of just reviewing your new changes, I have to re-review everything.

@tamird

Copy link
Copy Markdown
Contributor Author

Alex Ross (@alexr00) ack, will try to avoid that in the future. FWIW this is why I use reviewable.io for OSS projects I maintain. 20 years in GH code review is still extremely basic.

Local PR enumeration queried all Git config for every branch. Match all
requested branches in one helper-owned config read and one pass, keeping
the highest finite PR number and the first match on ties. Single-branch
lookups use the same helper; each enumeration reads fresh config.
First-activation branch association and branch deletion still reread
repository config for each branch. Read metadata once for the selected
branches, and inspect deletion leftovers after each mutation phase.
Only refresh the cleanup snapshot when fallback deletions are needed.
Keep association cleanup before that refresh so known metadata is
removed even if reading the remaining config fails.

Remove the single-branch metadata API and its manager wrapper. Callers
use the batch API even when they need only one branch, keeping each
operation responsible for the set of branches it requests.
The config key branch.feature.preview.remote belongs to feature.preview.
Matching the prefix branch.feature. when deleting feature can recreate
feature unnecessarily and remove the surviving branch's remote.

Use the last dot, before the variable name, to identify the complete
branch section in both cleanup passes. Scan each config snapshot once
for the whole batch.
Copilot AI lite review requested due to automatic review settings October 23, 2026 17:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The reviewed changes have no unresolved blocking issues and preserve existing behavior with regression coverage.

No open issues 🎉

Review effort: Lite

@tamird

Copy link
Copy Markdown
Contributor Author

Alex Ross (@alexr00), this compares the two commits from your review about the cleanup calls with the current three. Run it from a clone of this repository:

git range-diff --ignore-cr-at-eol \
  034c5709~2..034c5709 1a094297~3..1a094297 \
  --end-of-options --ignore-cr-at-eol

The two flags ignore the old CRLF conversion both inside each patch and when comparing the patches. Commit 1 is unchanged. Commit 2 shows the two cleanup calls restored and the test for that ordering. range-diff only lists the new third commit; its diff shows why deleting feature now leaves feature.preview alone.

If you already reviewed the September 30 update, use eae1d7ba~2..eae1d7ba as the first range to see just what changed since then.

Fetch the revisions if your clone doesn’t have them
git fetch --no-tags https://github.com/microsoft/vscode-pull-request-github.git \
  034c5709092b2d225e43399f1bbece203c7664f2 \
  eae1d7ba18b8c48fc233f91eeeceebc5fe1279fd \
  1a0942973c10afca34af3e3512e9bda250834581

— Codex, on Tamir’s behalf

@alexr00 Alex Ross (alexr00) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

@alexr00
Alex Ross (alexr00) enabled auto-merge (squash) October 28, 2026 15:11
@tamird

Copy link
Copy Markdown
Contributor Author

hey folks, is it expected that vscode-pull-request-github (pr) hasn't produced a result after 3 hours?

@alexr00

Alex Ross (alexr00) commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

No, PRs from forks need to be kicked, and sometimes I forget to do so. Thanks for the reminder!

@alexr00

Copy link
Copy Markdown
Member

/AzurePipelines run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
2 pipeline(s) were filtered out due to trigger conditions.

@alexr00
Alex Ross (alexr00) merged commit 1373d3a into microsoft:main Oct 29, 2026
3 checks passed
@tamird
Tamir Duberstein (tamird) deleted the perf/local-pr-config-snapshot branch October 29, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants