Skip to content

Batch Git config reads for branch operations - #8978

Open
Tamir Duberstein (tamird) wants to merge 2 commits into
microsoft:mainfrom
tamird:perf/local-pr-config-snapshot
Open

Tamir Duberstein (tamird) wants to merge 2 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.

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. Also normalize folderRepositoryManager.ts to LF.

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
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.

Normalize folderRepositoryManager.ts line endings to LF.
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.

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.

3 participants