Skip to content

[patch] support applying SGLang patch inside a git repo - #807

Merged
maocheng23 merged 1 commit into
sgl-project:mainfrom
FrankLeeeee:fix/spec-capture-patch-git-discovery
Sep 3, 2026
Merged

[patch] support applying SGLang patch inside a git repo#807
maocheng23 merged 1 commit into
sgl-project:mainfrom
FrankLeeeee:fix/spec-capture-patch-git-discovery

Conversation

@FrankLeeeee

@FrankLeeeee FrankLeeeee commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Motivation

scripts/apply_sglang_spec_capture_patch.sh silently does nothing when the installed SGLang lives inside a git checkout. It runs git apply from the site-packages directory. If that directory is nested in a repository, git resolves patch paths against the repository top level and skips every file outside the current subdirectory, then exits 0.

This happens if the user's env is inside specforge repo, e.g. users can call uv venv -p 3.12 in specforge repo and keep the virtual env there.

Modifications

  • Route all git apply calls in the script through one helper that sets GIT_CEILING_DIRECTORIES to the parent of the SGLang root. This stops repository discovery, so git treats site-packages as a plain directory and patch paths resolve correctly.
  • Add a regression test that places the fake site-packages inside a fresh git repository and checks that the patch applies, that a second run is idempotent, and that --reverse restores the original files. The test fails on the old script and passes on the new one.

Related Issues

Accuracy Test

Benchmark & Profiling

Checklist

@maocheng23
maocheng23 merged commit c49bab4 into sgl-project:main Sep 3, 2026
3 checks passed
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.

2 participants