+8

Add full support for shallow clone workflow

Christopher Kline 3 years ago updated by Thomas Singer 2 years ago 1

Shallow repos are extremely useful when working with huge repositories with long histories and large amounts of data (like binaries).


Since git 1.9 (with better support since 2.5), git has fully supported shallow repos (you can push/pull to/from the remote, etc), and is now very configurable. This lets developers pull down only a small amount of the history, making it faster to work locally (due to less data in the repo that needs to be maintained), and also avoiding the need to pull huge amounts of data over the network when cloning.


SmartGit currently has an option, when cloning a repo, to clone only to a specific depth. However, this is not sufficient for fully supporting a 'shallow repo' workflow, for the following reasons:

Missing functionality:


  • If you wish to clone to a specific depth, you only have the option of doing so if you un-check the "fetch all heads and tags". There is no support for fetching all heads so long as they are within the desired commit depth (the "--no-single-branch" option in 'git clone').
  • No support for choosing --shallow-submodules vs --no-shallow-submodules when cloning.
  • There's only an option to clone to a depth, and not "clone since date" (the "--shallow-since=<date>" option in git clone/fetch)
  • No support for --shallow-exclude in clone/fetch/pull
  • No way to change the desired depth after cloning (that I could find), to use subsequent fetches/pulls to trim or fill-in the history
  • No support for --unshallow, --update-shallow, or --deepen-shallow when fetching

Bugs (as of SmartGit 17.1 preview 6 #11041):


  • Regardless of what depth you clone to, when SmartGit does a subsequent fetch, it does not specific the desired depth, so you end up pulling the entire repo anyhow. This defeats the purpose of a shallow clone

This request is similar to https://smartgit.userecho.com/topics/395-implement-a-light-version-of-repository-management/ but expands upon it significantly.

+1

SmartGit 18.2 contains a command to set the repository depth.