Fix snapshot merge never matching gh-pages versioned dirs - #216
Merged
Merged
Conversation
git ls-tree does not expand pathspec glob wildcards the way git log/git diff do — 'v[0-9]*' is matched literally, so it never matched anything and the deploy job's 'Merge versioned snapshots' step silently skipped every stored snapshot, including v2. This is why https://fulll.github.io/github-code-search/v2/ 404s even though the snapshot is safely stored in gh-pages. List all top-level gh-pages entries and filter with the existing grep -E regex instead of relying on the pathspec.
Contributor
|
Coverage after merging fix/docs-snapshot-merge-pathspec-glob into main will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
The deploy job's `Merge versioned snapshots from gh-pages storage` step used:
```bash
git ls-tree --name-only origin/gh-pages -- 'v[0-9]*'
```
Unlike `git log`/`git diff`, `git ls-tree` matches pathspecs literally — it does not expand glob wildcards. So this pathspec never matched anything, the loop body never ran, and every versioned snapshot stored in `gh-pages` (including `v2`) was silently skipped when building the live Pages artifact.
This is why https://fulll.github.io/github-code-search/v2/ returns a 404 even though the snapshot is safely stored in the `gh-pages` branch.
Fix
List all top-level `gh-pages` entries (no pathspec) and rely on the existing `grep -E '^v[0-9]+$'` filter that was already there to skip non-version files like `.nojekyll`.
Verified locally against the real `gh-pages` branch — old code matches nothing, fixed code correctly finds `v2`.
Next step after merge
Once merged, dispatch `docs.yaml` on `main` (`gh workflow run docs.yaml --ref main`) to redeploy and pick up the `v2` snapshot.