fix(git-checkout): recover in narrowed-refspec (single-branch) workspaces#268
Open
fdaviddpt wants to merge 3 commits into
Open
fix(git-checkout): recover in narrowed-refspec (single-branch) workspaces#268fdaviddpt wants to merge 3 commits into
fdaviddpt wants to merge 3 commits into
Conversation
A large :N context on a file of long (minified) lines could dump hundreds of KB in one op, blowing the caller's context budget (~340KB observed). Add _cap_context_window: cap output at 16KB (configurable via builtin-ops.<op>.max_bytes / SUPERTOOL_<OP>_MAX_BYTES), truncate at a line boundary, append a footer pointing at the narrower tools (smaller :N, between:). Applied to around: (single-file + dir-aggregate) and the op_grep context branch (grep_around: and grep:-with-context). 6 TDD tests (red proven by neutralizing the cap). Docs: configuration.md table, operations/search.md cap section, .supertool[.example].json entries. Co-Authored-By: Max <noreply>
…docs - Remove the per-file cap from _around_one_file; cap only at op_around's single-file and dir-aggregate returns. Fixes double-capping (per-file + aggregate both 16KB) and interleaved truncation footers in dir fan-out. - _cap_context_window: nl >= 0 (was > 0) so a newline at offset 0 still trims; consistent byte-accounting for the dropped count. - Tests: +dir-aggregate cap (single footer), +single-giant-line no-newline. - Docs: note grep:PATTERN:PATH:LIMIT:CONTEXT shares the grep_around cap; align .supertool.json descriptions. Co-Authored-By: Max <noreply>
`git fetch --all` in a single-branch workspace only updates FETCH_HEAD — it never creates refs/remotes/origin/<branch>, so the retry checkout still fails. Fall back to an explicit `git fetch origin <ref>` + `git checkout -B <ref> FETCH_HEAD`. Closes #267 Co-Authored-By: Max <noreply>
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.
Problem
git-checkout:<branch>fails withref '<branch>' not found even after fetchin workspaces whoseremote.origin.fetchis narrowed to a single branch (e.g.+refs/heads/master:refs/remotes/origin/master). The auto-fetch fallback runsgit fetch --all --prune, which only updatesFETCH_HEAD— it never createsrefs/remotes/origin/<branch>— so the retrygit checkout <branch>still fails.Hit in DVSI Kevin-style single-branch automation worktrees.
Fix
When the retry still hits a pathspec error, fall back to the manual workaround:
-Bis safe here: this block only runs after the first plaingit checkout <ref>already failed, so a pre-existing local branch (which would have made that succeed) is impossible —-Bonly ever creates the branch.Audit
git-divergeandgit-mergedo not share the bug — neither auto-fetches nor assumesorigin/*tracking refs; both verify a local ref and tell the user to fetch.Tests
Added
test_narrowed_refspec_recovers_via_single_ref_fetch. 5/5 pass.Closes #267