fix: use git add --sparse to handle sparse-checkout on orphan branch first run#23571
fix: use git add --sparse to handle sparse-checkout on orphan branch first run#23571
git add --sparse to handle sparse-checkout on orphan branch first run#23571Conversation
…creation Agent-Logs-Url: https://github.com/github/gh-aw/sessions/409fef1d-ed92-46a5-9d2d-83ae9657714a Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
git add --sparse to handle sparse-checkout on orphan branch first run
|
@copilot review git add documentation |
There was a problem hiding this comment.
Pull request overview
Fixes first-run failures of push_repo_memory.cjs when creating a new orphan “memory” branch under an active sparse-checkout by staging changes with git add --sparse ..
Changes:
- Update staging step to use
git add --sparse .to bypass sparse-checkout restrictions after orphan branch creation. - Add regression test asserting
--sparseis present and that the prior"add", "."form is absent.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| actions/setup/js/push_repo_memory.cjs | Switches staging to git add --sparse . to prevent sparse-checkout reactivation from breaking first-run pushes. |
| actions/setup/js/push_repo_memory.test.cjs | Adds a regression test that enforces the --sparse usage in the script. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…umentation Agent-Logs-Url: https://github.com/github/gh-aw/sessions/7b5cf987-0bae-497f-a5b8-e69a09bf3ed8 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Reviewed the
Updated the comment in Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
push_repo_memory.cjsfails on first run for a new memory branch becausegit checkout --orphansilently re-activates sparse-checkout, causing the subsequentgit add .to reject files outside the sparse-checkout cone.Changes
push_repo_memory.cjs: Replacegit add .withgit add --sparse .at the staging step — stages files unconditionally regardless of sparse-checkout state.push_repo_memory.test.cjs: Add regression test asserting--sparseis present and plain"add", "."is absent.