-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sparse checkout support for refresh and pop
This relates to sparse checkout support in StGit (#195). Since libgit2 does not support git's sparse checkout feature, when getting worktree file status via the git2 API in a sparsely checked-out worktree will indicate that all known files outside the sparse checkout cone(s) are deleted. This is the first of several problems preventing `stg refresh` from working correctly in the context of a sparsely checked-out worktree. The next problem is that when building the index for the refresh, the git2 API is further tripped-up and "adds" deletion entries for all the out-of-cone files. By using `git` (via the stupid module) for status and index operations, `stg refresh` is made to work with sparse checkout. The stupid module is converted from a single file into a directory (stupid/mod.rs) in order to make room for some higher level abstractions for status and changed files. The new stupid::status module provides abstractions for handling the output of `git status --porcelain=v2`. Care is taken to minimize allocations and defer processing. Allocations are minimized by Statuses holding onto the status output buffer (the only allocation) and providing references into that buffer for its various methods. A similar approach is used in stupid::diff, which provides an abstraction over the modified file list coming from `git diff-tree --name-only`. To make `stg pop` work, worktree and index status checks are now performed using `git status` instead of libgit2. Eventually, all StGit commands will need to use this approach to avoid problems in sparse checkout worktrees.
- Loading branch information
Showing
12 changed files
with
1,191 additions
and
364 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.