+3

Sparse Checkout

Derrick Southerland 4 years ago updated by Marc Strapetz 4 years ago 1

Please consider adding sparse checkout support once it becomes more stable in git.

https://git-scm.com/docs/git-sparse-checkout

The motivations for why someone would use this are well described here:

https://github.blog/2020-01-17-bring-your-monorepo-down-to-size-with-sparse-checkout/

Related topics:

+1 (+100 if I could).

@Derrick, git checkout respects your current sparse filter patterns (at least it did when I tried with Git 2.28). You'll need to use the command line or manually edit the pattern file if you want to change the sparse filters - ie, to change the paths in your "work area" (or workspace as other VCS like to call it), but otherwise I don't think you need to leave the GUI?


What I'd really like to see though, is to be able to click a repo in the left pane Repo view and see the repo's file/folder tree (note that this would show all files/folders available in the repo - at HEAD maybe? - not just what's in the sparse worktree). The utility of this is that:

  1. We can see what's in the repo vs our sparse workspace (similar to Perforce P4V's depot vs workspace view), possibly with a badge icon to indicate whether something is or isn't part of our sparse filter. 

  2. We could right-click to add/remove files and folders from the patterns in the sparse-checkout file (ie, to add/remove paths from our "work area"). Similar logic to adding patterns to .gitignore, but would also need to handle "cone mode" patterns.
  3. The Log graph could be filtered depending on our "work area" or which files/folders we have selected in the Repo view, so we can focus on just the history for the files we care about.

For performance, the Repo view would only need to show the repos at first, then selectively reveal files/folders when we expand a repo and its subfolders (currently already achievable from the command line using "git ls-tree").

Also, once Git's partial clone path-based filters mature a bit, the Repo view could possibly also be used to optionally change the partial clone filters at the same time (see https://smartgit.userecho.com/communities/1/topics/1223-partial-clone-support-git-219-and-higher-sg-13863).

This way, we'd be able to see and change the "shallow clone" depth, "partial clone" filter and "sparse checkout" patterns all in the same place without leaving the GUI. Gamechanger!