Git support modes
Sapling supports Git in 2 modes. Here is a quick comparison:
.git mode | .sl mode | |
|---|---|---|
| Repo created by | git clone or git init | sl clone or sl init |
| Repo directory | .git | .sl |
git commands | ✅ Supported | ⚠️ Not supported |
| Git LFS | Partially supported 1 | ⚠️ Not supported |
| Submodules | Work-In-Progress | Supported without EdenFS |
| ISL (graphic interface) | ✅ Supported | ✅ Supported |
| EdenFS (virtual filesystem) | ⚠️ Not supported | ✅ Supported (experimental 2) |
| Git network protocol (Git or Mononoke server) | ✅ Supported | ✅ Supported |
| Sapling network protocol (Mononoke server) | ⚠️ Not supported | ✅ Supported (experimental 2) |
.git mode
In this mode, Sapling tries to be compatible with .git/ file formats so you can run git commands. For features not natively supported by Git like mutation, Sapling will store them in the .git/sl directory.
There are some caveats using the .git mode:
- Mixing
slandgitcommands might not work in all cases. For example:- If your
sl rebaseis interrupted, usesl rebase --continueto continue, you cannot usegit rebase --continue. - Similarity, use
git rebase --continuefor an interruptedgit rebase. - If you run
sl addto mark a file as tracked, usesl statusandsl committo commit the change.sl addmight not affectgit statusorgit commit.
- If your
slmight put the repo in a "detached head" state. This is okay if you only runslcommands. However, if you usegitcommands, be sure to rungit branch some_nameto create a branch beforegit checkoutaway to avoid losing commits.- LFS 1 or other
.gitattributesfeatures are partially supported.sl gotorunsgit checkoutunder the hood. Otherslcommands likecommitordiffdo not respect.gitattributes. You can usegitinstead. sldoes not have local tags. You can useorigin/tags/v1.0to refer to thev1.0tag stored on theoriginserver.- Currently, sub-modules are not fully supported.
- Currently, ISL might not detect repo changes as quickly or automatically as other modes. Use the refresh button to recheck manually if necessary.
.sl mode
In this mode, Sapling can utilize more scalability features, although some are not yet built in the public release. For example:
For the working copy implementation, Sapling can use its own implementations:
- Physical filesystem: together with watchman,
addorremoveoperations can be O(changed files) instead of O(total files). There is no need to re-write a potentially large file like.git/index. - Virtual filesystem (EdenFS): With
eden, andslbuilt with Thrift support, you can runeden clone <sl_git_working_copy> <new_working_copy>to get a virtual working copy which has much bettergotoperformance.
For server protocols, Sapling can use dedicated lazy commit graph protocols so clone and pull are roughly O(merges) both in time and space usage.
For local storage, Sapling can use its own structure and compression so the file count is bounded and there is no need to repack. Note: This is not fully implemented for the git format yet but is the direction we'd like to go.
Footnotes
-
Sapling can write Git LFS files to disk on
goto. However, if you need to make changes or create new LFS files, or view their diffs, you need to usegitcommands. ↩ ↩2 -
Source code to support those exists on GitHub. However, EdenFS, Mononoke, and Sapling with EdenFS support are not yet part of the public GitHub releases yet. ↩ ↩2