github / github/copilot-cli

Feature: Apply sparse-checkout at session worktree creation to avoid full-checkout timeouts on large repos

未關閉
#4,145 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area:configuration area:sessions
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

### Describe the feature or problem you'd like to solve

Apply sparse-checkout at session worktree creation to avoid full-checkout timeouts on large repos

### Proposed solution

## Summary

When the app creates a new project session, it runs `git worktree add`, which
checks out the **entire** working tree. For very large monorepos this checkout
is slow enough to **time out**, so sessions fail to start.

New worktrees do **not** inherit sparse-checkout config from the main repo, and
hooks (e.g. `PreToolUse`) only fire *after* the worktree exists — so there is
currently no way to avoid the full checkout from the user side.

## Problem

- Repo: very large local repo (working tree in the multi-GB / high-file-count range)
- `git worktree add ` materializes the full tree
- Worktree creation times out → session cannot be created
- No pre-worktree hook / config exists to scope the checkout

## Proposal

Add a config option to scope the checkout when creating session worktrees, e.g.:

```jsonc
// settings.json
{
"session": {
"worktree": {
"sparseCheckout": {
"enabled": true,
"cone": true,
"paths": ["src/app", "libs/shared"]
}
}
}
}
```

### Example prompts or workflows

_No response_

### Additional context

Prior art / related
#2399 — sparse-checkout for plugin installs
#2463 — sparse-checkout for marketplace clones
Both apply sparse-checkout to reduce clone cost, but only for plugins/marketplace,
not for session worktrees. This request covers the session-creation path.

Environment
Copilot CLI version: 1.0.71-2
OS: Windows
Repo: local-only, very large working tree

貢獻指南

開啟貢獻指南

研究方向

從 session worktree 的建立路徑和 `git worktree add` 呼叫開始,然後確定如何在 checkout 之前套用設定。完成標準是 session worktree 可以使用提議的 sparse-checkout 設定,讓大型儲存庫不必具現化完整樹狀結構並避免逾時。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
git
領域
cli
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
冷清
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。