58 issue fixes · 34 other changes
v0.5.27 fixes many rebase, merge, reset and ref-handling bugs and speeds up large-repo operations such as reset --hard, ref listing and since-bounded log/revs.
`grit stash list --json` now returns an extensible object containing `action: "list"` and an `entries` array, including for an empty stash. Human and Markdown rendering remain unchanged, while the machine contract advances to a documented v2 schema and keeps v1 frozen.
Unstaged diff no longer scans untracked files or feeds them into rename detection. A plain filesystem move now appears as deletion of the tracked source, while the destination and unrelated new files remain exclusively in status as untracked paths.
Human-facing status paths now remain meaningful when invoked inside untracked directories: the current collapsed directory is shown as `./`, ancestor directories as `../`, and all collapsed directory entries retain `/`. JSON remains unchanged and repo-relative.
Patch rendering now derives blob ids from the actual resolved text or symlink bytes before writing `index` headers. Raw worktree diff entries remain unchanged, while binary behavior, absent sides, and gitlink commit ids retain their existing semantics.
Fetch and pull now preserve prior remote-tracking tips in reflogs after branch updates, while initial clone still imports branch refs in one packed batch and logs only the remote HEAD. Pruning removes the corresponding reflog, and logging follows core.logAllRefUpdates/existing-log policy through the selected ref-store backend.
This change prevents delta search from cutting a run of versions for the same path at an arbitrary byte ceiling. Edited multi-megabyte blobs therefore remain visible to one sliding window and collapse to one full base plus deltas instead of retaining a second full copy.
SSH upload-pack connections now request the configured Git wire protocol and correctly tell OpenSSH to forward GIT_PROTOCOL. Remote fetch/listing defaults to protocol v2 while configured v0 and receive-pack push remain on v0.
Ref advertisements are emitted incrementally instead of being retained as owned names and duplicate line buffers. Reftable stack files stay in shared file-backed mappings, and HTTP discovery now carries advertisement chunks through a bounded channel, limiting per-request anonymous memory.
Smart HTTP fetch request bodies are streamed into upload-pack instead of buffered behind the former 32 MiB cap. Decoded fetch input is bounded at 1 GiB, including highly compressible gzip requests, and protocol v2 now preserves that transport limit as HTTP 413 rather than converting it to an HTTP 200 ERR pkt-line.
Rebase resume planning now honors pending replay work and seeded mappings even when the edit map is empty. This prevents continue or skip after an early conflict from discarding the session as an empty rewrite.
Rebase continuation and skip now retain partial replay state when the filtered edit map is empty but seeded mappings or remaining commits still require work. Human and Markdown output also reserve “Already up to date” for true no-op outcomes with no head movement.
Resumed rebase planning no longer mistakes an empty explicit edit map for an empty operation. Continue and skip now replay the remaining commits and finish the branch when the first commit in a multi-commit rebase was the conflict stop.
Switch branch creation now exposes existing typed library errors for duplicate names, invalid names, and unborn repositories instead of forcing embedders to parse English text. Revision start-point failures are also typed consistently, and switch JSON output classifies the new branch errors with stable kinds.
This change makes reversed bounded history listings keep the newest requested window and merely print that window oldest-first. It applies the probe-aware truncation consistently to log, author grouping, and revs, with regression coverage for skip, dates, JSON truncation, and OID order.
Repository-level index writes now consistently follow the index selected by `GIT_INDEX_FILE`, including lock-based updates and commit-hook environments. This prevents commits, mixed resets, and cached removals from silently changing `.git/index` when an alternate index is active.
Uses the existing date-bounded dense path walker when a commit filter is combined with a pathspec, then applies `--since`/`--until` eligibility before counting or emitting visible matches. The round-2 follow-up also keeps the required frontier parent available and deletes only an older grandparent in the missing-object regression.
Moves now rename tracked paths without deleting source directories that become empty. This also applies consistently to force-destination cleanup and rollback, preventing a move from invalidating a shell whose current directory was the emptied source.
Packed-refs iteration now streams sorted files while preserving the ref store’s sorted/unique callback contract. The round-3 fix first validates ordering without invoking the visitor, so a file that falsely claims `sorted` falls back to one sorted materialized emission instead of replaying records.
This change makes multi-commit rebase resume consume the saved tail even when no explicit commit edits remain. Continue and skip now replay descendants from the seeded parent mapping, update the branch tip, reattach HEAD, and only then remove rebase state.
Long-form `:(top)` pathspecs now remain anchored at the repository root when grit is invoked from a subdirectory. The change covers worktree and revision-walk resolution and verifies diff, status, add, restore, rm, stash, range diff, glob, and exclude behavior against system Git.
This change relocates the file side of a directory/file conflict to a labeled sibling such as `f~side` instead of writing it over the directory. It also makes abort remove blocking files before restoring the original tree, while preserving correct unmerged index stages for staged and auto-stage commit behavior.
Attribute pathspecs now use the repository attribute stack in path-limited history and staging, including patterns ending in a directory slash. Empty filtered logs are silent instead of claiming the repository has no commits, while truly empty repositories retain that message.
Nested repositories staged by add or commit are still recorded as Git-compatible mode-160000 gitlinks, but grit now exposes that fact through library outcomes and warns users that clones will not contain the nested files. Status identifies embedded repositories, clone distinguishes real submodules from bare gitlinks, and the round-two fix makes commit dry-run work for newly staged gitlinks instead of failing internally.
Fetch and pull now unwind through library cancellation on TERM/HUP, clean their in-progress pack artifacts, and return exit 130. Gc and prune reclaim expired temporary object artifacts while preserving fresh, disabled-by-policy, dry-run, unrelated dotted paths, and install-shaped regular files.
Resume planning now distinguishes a truly empty rewrite from a conflict session that still carries a seed or replay tail. Skip can drop the stopped commit and continue can preserve the user’s resolution while replaying descendants; human output reports branch-tip movement when no rewritten rows are displayed.
Unreadable worktree directories are now non-fatal during status and commit. Grit emits structured, pathful diagnostics, keeps inaccessible tracked entries unchanged, continues reporting accessible changes, and exposes warnings in status JSON.
Streams mmap-backed packed refs into ref enumeration and merges them with loose refs, carrying packed peel information and respecting callback early termination. The round-two patch tightens line validation and delays emission by one record to address corrupt input and lying `sorted` headers, but delayed emission is insufficient for a later inversion.
Embedded repositories whose HEAD does not resolve can no longer be turned into empty executable blobs or used to collapse unmerged gitlink stages. Staging and commit return a typed error without changing the index, while normal status output collapses nested untracked repositories consistently.
Streams sorted packed refs without retaining a second copy of every ref name, while preserving sorted, unique loose-over-packed listing semantics. A validation pass detects lying sorted headers before callbacks, then either streams the mmap-backed records or materializes a sorted fallback.
This changes one-sided three-way merge span handling so an insertion touching a deleted or replaced ancestor span is grouped into the same conflict. It also fixes the retained-side marker body for replace-plus-trailing-insert conflicts and adds system-Git byte-for-byte regression coverage.
Makes the repository identity guide compile-backed and usable by external grit-lib callers. The guide now demonstrates CommitRequest::new, assigns the resolved author through the public field, and explains that an unset committer is resolved from the repository.
This change makes tree transitions treat legacy regular-file modes as their canonical index equivalents. Clean repositories with historical 100664/100775 tree entries can now switch or fast-forward merge, while actual content and executable-bit changes still block as appropriate.
Adds opt-in within-file moved-line attribution to the library and exposes it as `grit blame -M`; all copy-detection levels imply move detection to match Git. The round-two fix corrects the small permutation oracle so its expected commit ownership now matches both system Git and grit.
This change prevents packed annotated tags from being treated as their peeled commit when refs are listed. Push planning now retains the tag-object OID, so `push --tags` reports an existing identical tag as up to date instead of silently replacing the remote annotation with a lightweight tag.
This makes the documented tree-diff-to-diffstat library path honor rename options, so renamed content is paired instead of counted as a deletion plus an addition. It also makes `DiffTarget::Trees` consistently accept commit or tree object IDs, including the empty-left-side/root-tree case fixed in review round 2.
Hard reset now removes worktree files represented only by unmerged index stages when those paths are absent from the target, fixing leaked conflict files after pick/revert abort, skip, and reset --hard. The round-2 safety fix prevents that cleanup from traversing a symlinked parent and deleting data outside the repository.
Merge-preserving rebases now use a stable priority topological order, so every in-range parent is rewritten before its child while ready side branches still precede ready mainline commits. This prevents a topic forked after an earlier merge from retaining old ancestry and duplicating that earlier topic and merge in the rebased graph.
Interrupted commits can no longer leave full index copies behind indefinitely. Index-locking operations and gc now identify `next-index-<decimal pid>` files whose owner process is gone, while retaining live-process, current-process, and malformed-name files.
This change makes a directory rename that only changes letter case resolve to the requested destination spelling instead of treating that spelling as an existing directory and appending the source basename. It also preserves unrelated destination collision protection and avoids treating symlink pairs as the same directory dentry.
Prevents merge-tree materialization from treating a sibling such as `a0/` as a descendant of `a/`, which previously caused unbounded recursion and SIGABRT. Invalid prefix relationships now return an error, and partial writes descend from an empty tree when a selected directory is absent from the base.
Hard reset now plans rollback from the pre-alignment index, avoids per-path cache-tree invalidation on wide updates, attaches the target cache tree during checkout, and skips a redundant post-checkout stat pass when bulk checkout populated every dense entry. The round-3 follow-up confines spool instrumentation to unit tests and replaces the banned unit mutex with a bool-backed state lock.
Hard reset can now parallelize its wide worktree stat scan while keeping index preload disabled, preserving the intended memory bound. The branch also carries the previously reviewed merge-abort simplification and result-tree checkout wiring; all changes remain internal to grit-lib.
This replaces eager closure of all excluded history with a two-sided range paint and a compact hide predicate. Bounded range walks with path, author, parent, topo, stream, group-by, and dense-path filtering can now stop near the common frontier instead of parsing the entire hidden ancestry.
This change keeps large-object reads and writes bounded in memory while reducing zlib and pack-mapping overhead. It bounds inflate windows, streams CRC verification during packed reads, streams writes from 1 MiB, and chooses stored zlib for first chunks that do not compress; round two repairs truncation handling and restores geometric loose-buffer growth.
This change makes an unbounded default-order `--since` revision walk stop at the date frontier instead of traversing the entire reachable history. The review follow-up restores correctness for parent selectors and for `--count --skip --since`, with direct comparisons against system Git.
This change teaches status and tracked staging to persist fsmonitor-valid bits for files a real worktree scan proved unchanged. The round-3 correction keeps chmod/type-only changes invalid and visible on subsequent status calls while retaining the large-repository speedup.
The HTTP client now turns complete percent-decoded credentials embedded in a clone URL into an in-memory, origin-scoped Basic authorization cache. Same-origin bundle downloads reuse that cache without putting secrets in the advertised URI or resumable state; rejected URL credentials fail immediately without invoking a helper, and resumable auth failures no longer consume five transport retries.
This change replaces the mixed checkout's broad untracked walk with targeted collision checks and applies hard-reset index changes in bulk. Round 3 adds a restricted pre-reset worktree diff so unchanged paths avoid a second full stat scan while ordinary dirty paths are still restored.
Repairs no-commit-graph range walks when committer-date skew lets an excluded-side path reach commits already popped as positive-only. The repair now traverses painted frontier state first, bounds unpainted bridge exploration, and keeps both list and count APIs aligned with system Git.
Hard reset now overwrites staged content on paths whose committed tree entry is unchanged between the source and target commits. The performance test also measures a real reset on every Git sample instead of timing no-ops, and a one-line revwalk call-site repair keeps the rebased branch compiling.
This repairs range-walk membership under severe committer-date skew while keeping the hide-side repair local. The follow-up makes the performance regression test discriminate the bounded implementation from the exact prior unrestricted traversal pattern that previously slipped through at the ceiling.
Restore now records a temporary tree representing files actually present on disk before refs and the index are rewound. Checkout compares that disk tree with the captured snapshot, so undo removes files introduced by a switch/commit and recreates tracked files deleted after capture while preserving the existing index and operation-state restoration sequence.
Stateless protocol v0/v1 upload-pack now emits any deepen-driven `shallow`/`unshallow` records and their terminating flush before processing haves and writing ACKs. It retains existing stateful and protocol-v2 behavior and avoids inserting a leading flush for requests that contain only client `shallow` lines.
Workspace snapshots can now be serialized and restored across processes, while explicit pin/unpin APIs keep their generated worktree trees and blobs alive through Git and grit garbage collection. The round-2 correction makes that persistence usable with non-self-describing binary serde formats by using an externally tagged RawRef enum and correctly encoding optional index mtimes.
Default three-way text merges now treat a missing final newline as a real line-record change. This preserves the newline state selected by the side that changed it, even when that side also inserted or deleted earlier lines, and removes an unsafe length-dependent workaround.
Custom reference backends can no longer inherit a racy reflog rewrite that silently overwrites concurrent appends. Each backend must implement a locked read-transform-write, and the shared conformance suite now exercises serialization against a concurrent ref update.
Fsck now treats commits referenced only by an injected ref backend's reflogs as reachable, preventing embedders from misclassifying undo history as dangling. The same backend-aware reflog access is used for rev-list, while linked-worktree HEAD reflogs continue to be collected from their administrative directories.
Clone setup now writes every clone reflog entry through the repository's configured RefStore. Embedders using MemoryRefStore or another injected backend receive HEAD and branch history without stray `<git_dir>/logs` files, while files-backed repositories retain the existing Git-compatible on-disk path.
Moves uncommitted blame identity selection and hunk line-range ownership from grit-cli into grit-lib. Library users can now obtain hunk line slices and the same uncommitted author labels as the CLI without reimplementing cursor-based regrouping.
Sparse switches now leave absent out-of-cone directories opaque when their index row still represents HEAD, retargeting the row directly to the destination subtree instead of expanding tens of thousands of descendants. The checkout also rebuilds invalid sparse cache-tree roots and avoids reloading the full index for collision reporting unless `core.ignorecase` is enabled.
This branch contains no changes: it points to the same fcd91f911 commit as origin/main. The intended IndexHandle public-API snapshot ordering correction is already present on main from 49c17c714, so integration is a no-op.
This change caches per-directory ignore state so bulk ignore checks no longer rebuild ancestor rule stacks or allocate matching groups for every path. It also normalizes CLI path batches once, adds coverage, and records the benchmark result; round two only rewrote the four commit messages, leaving every tree unchanged.
Rebase sessions now reuse the shared history commit readers instead of maintaining private copies. Corrupt object IDs in saved rebase plans return a specific public error, with a clear CLI message and regression coverage that verifies the operation state is retained.
Deletes the unused rev-list pretty/format renderer and replaces its remaining parent-walk signal with the existing explicit `parent_rewrite` option. Supported `grit log` and `grit revs` rendering remains separate and unchanged; tests now validate the retained parent-rewrite behavior directly against system Git.
Removes dead and test-only grit-lib APIs, an unused reflog formatter and history counters, and stale benchmark fixture code. It updates the public API snapshot and library layout documentation, while repairing benchmark target compilation and warnings. Round 2 only rewrites the two commit messages to remove forbidden co-author trailers; the source trees are unchanged.
Removes one unused private reflog formatter and deletes an unused 10k-file benchmark fixture. It also resolves benchmark-only unused-result, unused-field, and unused-import warnings without changing benchmark bodies or production behavior.
The ref-query hot path now records each resolved peel once, filters rows with a keep mask, and avoids unnecessary commit-cache/ranking work when all tips are merge targets. It adds Git-compatibility coverage and committed benchmark evidence; round two only rewrites the two commit messages, leaving both code trees byte-for-byte unchanged.
Adds one canonical way to obtain the tree named by HEAD and replaces repeated resolve/read/parse sequences across diff and porcelain paths. Strict callers use `Repository::head_tree`; callers that historically treated invalid HEAD like an empty repository use `HeadState::tree`.
Adds a lightweight repository locator for config-only operations so `grit config` can avoid opening refs and the object database. The locator reuses one merged config cascade, preserves full discovery semantics for layout-changing configuration, and config writes retain lockfile-plus-rename atomicity while dropping an unnecessary fsync.
Index serialization now streams through a bounded 128 KiB hashing buffer directly into the lock file instead of retaining a complete serialized index body in memory. The review-fix round only rewrote the three commit messages; its tip is tree-identical to the already reviewed implementation.
This change replaces a string-based corrupt rebase-plan OID failure with a documented `RebaseSessionError::InvalidStateOid`, including the offending value. It also deduplicates rebase-session commit reads onto shared history helpers while preserving each caller's established typed outer error.
This change repairs the files-ref backend’s concurrent file/directory create handling and restores the scripts CI mapping check. The round-2 correction preserves Git-compatible behavior by replacing a stale empty directory at the exact ref path, while directories containing refs or in-flight locks remain conflicts.
This change lowers worktree-diff memory by shrinking stale-stat hash jobs to index positions plus exceptional attributes, then constructing diff entries only for changed files. It also replaces unbounded per-directory merged attribute caching with a shared stack for the current directory chain, with regression tests and committed before/after benchmark reports.
Blame results now carry complete placeholder metadata for uncommitted worktree or caller-buffer lines, and each library hunk records both its uncommitted state and the range of attributed lines it covers. The CLI no longer invents that identity or walks hunks with its own cursor; it only renders the library result.
Repairs the upload-pack advertisement compile break introduced by the streaming request-body merge and synchronizes the generated public-API snapshot. The Rust change supplies an empty mutable reader without changing advertised bytes or protocol behavior; the snapshot change only reorders existing API entries.
Fixes the docs site’s strict validation by removing a rustdoc link to a doc-hidden FetchOptions method and correcting the switch page’s relative link to the clone command. The delta is two one-line documentation corrections and does not alter Rust behavior or public APIs.
Hard reset now stats tracked files relative to open directory handles instead of repeatedly walking absolute paths, and it uses a sorted stat vector rather than a hash map. Checkout-created regular files are marked content-verified so index writing does not immediately reread/re-hash them; size-changed regular files are rewritten directly.
Adds an opt-in grit-lib hot-text layout that groups frequently co-executed library/runtime/dependency functions into a contiguous ELF section on x86_64 GNU/Linux. The grit CLI enables it by default, cutting short-command code-page RSS while leaving repository behavior and formats unchanged.
Branch creation now returns the branch's effective upstream as part of the library outcome. The CLI simply renders that field, eliminating its separate dry-run tracking resolver and post-create config lookup; forced-reset dry runs now match live output when existing tracking is retained.
Remote-supplied Git protocol failures now remain a typed `Error::RemoteFatal` instead of being flattened into generic message errors. Round 2 closes the smart-HTTP discovery gap so v0 and v2 `ERR` responses fail consistently through both public body-discovery APIs.
This change detects an explicit non-LLD linker in Cargo's encoded or plain Rust flags and turns off grit-lib's LLD-only hot-text linker-script injection for that build. It also gates the grit-cli ELF-layout assertion under the same decision and adds regression coverage for linker detection.
Reset now avoids reading packed ref tips when their file timestamp proves they cannot reach newly orphaned commits, while retaining a full-walk fallback. It also moves the ref with compare-and-swap and appends reflogs directly, avoiding transactions whose cost grows with reflog length.
Removes test-only rev-list APIs left behind by the retired compatibility CLI and deletes the now-unreferenced duplicate ref-exclusion implementation. It also drops an unused HTTP-server dependency and an unused reftable test accessor, for a net reduction of 832 lines while preserving production walk and ref-advertisement behavior.
Refreshes the checked-in grit-lib public API snapshot so it matches the API already emitted by the library. This is metadata-only: no Rust implementation, test behavior, on-disk format, wire protocol, or CLI behavior changes.
This corrects date-cutoff traversal so an older commit does not enqueue parents once every remaining queued commit is also older than `--since`. The same frontier ordering is applied to reachable, streaming, and path-limited walks, while bounded `--since` lists avoid a linear fast path that cannot preserve Git's frontier behavior.
This change stops reachable-history traversal at Git's `--since` frontier instead of following parents through an already-too-old commit. It also routes since-bounded linear histories through the general reachable-walk implementation so skewed dates receive the same frontier semantics.
This change teaches the existing profile-driven linker-layout generator to emit a second hot-code fragment for CLI startup, clap, rendering, and CLI-instantiated generics. The shipped x86_64 GNU/LLD binary places that section beside grit-lib's hot section before ordinary text, reducing startup code faults and resident memory without changing command behavior or repository formats.
This review contains no code change. The investigation establishes that branch/list-json on many refs remains dominated by shared CLI startup costs, so the author correctly avoided a benchmark-specific grit-lib or CLI patch that would not materially improve the row.
This removes one redundant rustdoc link destination and updates one generated public-API snapshot field position. Together those two one-line corrections restore the rustdoc and public-api checks without changing executable behavior.
This review branch contains no changes relative to origin/main. The two-line CI repair it references—one rustdoc link simplification and one public-API snapshot ordering update—was already merged into main as 6def0af921e6ba9d73044b1358165e8ae060c736.
This change restores compilation after the range-walk hide type refactor by supplying the expected empty `RangeWalkHide`. It also makes the public streaming-write documentation acceptable to rustdoc by referring to the private threshold constant as code rather than an intra-doc link.
Updates the since-cutoff streaming revision walk to pass the empty `RangeWalkHide` value required by `streaming_date_walk`. This is a one-line compilation repair with no behavior or compatibility surface change.