Skip to content

Commit 9018727

Browse files
Merge pull request #181: Create the "docs/" folder with some user-facing documentation
Create a set of docs that we can expand more as we prepare for public release. I created the markdown docs inside the `docs/` folder as that can be used as the root of a GitHub pages deployment. The intention is that `index.md` will be rendered as the homepage, and will link to the other documents. I included docs for the verbs we will definitely keep into the future. If we change how these verbs work, then we will want to update the docs. If we do not remove all of the other verbs in time for public release, then we should add docs for them. The "frequently asked questions" is a bit pre-emptive. No one actually asked these questions, but I anticipate them being asked. As an aside, I added a "repository image" to the repo, so I added the SVG and PNG for that, too.
2 parents 65591ea + e7b9ee5 commit 9018727

File tree

8 files changed

+345
-0
lines changed

8 files changed

+345
-0
lines changed

Scalar/Images/scalar-card.png

33.7 KB
Loading

Scalar/Images/scalar-card.svg

Lines changed: 82 additions & 0 deletions
Loading

docs/commands/scalar-clone.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
`scalar clone`
2+
==============
3+
4+
The `clone` verb creates a local enlistment of a remote repository.
5+
6+
Usage
7+
-----
8+
9+
`scalar clone [options] <url> [<dir>]`
10+
11+
Description
12+
-----------
13+
14+
Create a local copy of the repository at `<url>`. If specified, create the `<dir>`
15+
directory and place the repository there. Otherwise, the last section of the `<url>`
16+
will be used for `<dir>`.
17+
18+
At the end, the repo is located at `<dir>/src`. By default, the sparse-checkout
19+
feature is enabled and the only files present are those in the root of your
20+
Git repository. Use `git sparse-checkout set` to expand the set of directories
21+
you want to see, or `git sparse-checkout disable` to expand to all files. You
22+
can explore the subdirectories outside your sparse-checkout specification using
23+
`git ls-tree HEAD`.
24+
25+
Options
26+
-------
27+
28+
These options allow a user to customize their initial enlistment.
29+
30+
* `--full-clone`: If specified, do not initialize the sparse-checkout feature.
31+
All files will be present in your `src` directory. This behaves very similar
32+
to a Git partial clone in that blobs are downloaded on demand. However, it
33+
will use the GVFS protocol to download all Git objects.
34+
35+
* `--cache-server-url=<url>`: If specified, set the intended cache server to
36+
the specified `<url>`. All object queries will use the GVFS protocol to this
37+
`<url>` instead of the origin remote. If the remote supplies a list of
38+
cache servers via the `<url>/gvfs/config` endpoint, then the `clone` command
39+
will select a nearby cache server from that list.
40+
41+
* `--branch=<ref>`: Specify the branch to checkout after clone.
42+
43+
* `--local-cache-path=<path>`: Use this option to override the path for the
44+
local Scalar cache. If not specified, then Scalar will select a default
45+
path to share objects with your other enlistments. On Windows, this path
46+
is a subdirectory of `<Volume>:\.scalarCache\`. On Mac, this path is a
47+
subdirectory of `~/.scalarCache/`. The default cache path is recommended so
48+
multiple enlistments of the same remote repository share objects on the
49+
same device.
50+
51+
Advanced Options
52+
----------------
53+
54+
The options below are not intended for use by a typical user. These are
55+
usually used by build machines to create a temporary enlistment that
56+
operates on a single commit.
57+
58+
* `--single-branch`: Use this option to only download metadata for the branch
59+
that will be checked out. This is helpful for build machines that target
60+
a remote with many branches. Any `git fetch` commands after the clone will
61+
still ask for all branches.
62+
63+
* `--no-prefetch`: Use this option to not prefetch commits after clone. This
64+
is not recommended for anyone planning to use their clone for history
65+
traversal. Use of this option will make commands like `git log` or
66+
`git pull` extremely slow and is therefore not recommended.
67+

docs/commands/scalar-diagnose.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
`scalar diagnose`
2+
=================
3+
4+
The `diagnose` verb collects logs and config details for the current repository.
5+
The resulting zip file helps root-cause issues.
6+
7+
Usage
8+
-----
9+
10+
`scalar diagnose`
11+
12+
Description
13+
-----------
14+
15+
When run inside your repository, creates a zip file containing several important
16+
files for that repository. This includes:
17+
18+
* All log files from `scalar` commands run in the enlistment since `clone`.
19+
20+
* Log files from the Scalar service.
21+
22+
* Configuration files from your `.git` folder, such as the `config` file,
23+
`index`, `hooks`, and `refs`.
24+
25+
* A summary of your shared object cache, including the number of loose objects
26+
and the names and sizes of pack-files.
27+
28+
As the `diagnose` command completes, it provides the path of the resulting
29+
zip file. This zip can be sent to the support team for investigation.

docs/commands/scalar-maintenance.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
`scalar maintenance`
2+
====================
3+
4+
The `maintenance` verb runs one of several maintenance tasks that normally
5+
happen in the background.
6+
7+
Usage
8+
-----
9+
10+
`scalar maintenance --task=<task> [--batch-size=<size>]`
11+
12+
Description
13+
-----------
14+
15+
Run the maintenance task specified by `<task>`. The options are:
16+
17+
* `commit-graph`: Update the Git commit-graph to include all reachable
18+
commits. After writing a new file, verify the file was computed successfully.
19+
This helps commands like `git log --graph` work very quickly.
20+
21+
* `commits-and-trees`: Download the latest set of commit and tree packs from
22+
the cache server or the origin remote.
23+
24+
* `loose-objects`: Examine the loose objects contained in the shared object
25+
cache. First, delete any loose objects that are currently located in
26+
pack-files. Second, create a new pack-file containing the remaining loose
27+
objects. The pack will contain up to 50,000 objects, leaving any extra
28+
objects for the next run of the `loose-objects` step. This happens in the
29+
background once a day.
30+
31+
* `pack-files`: Update the Git multi-pack-index and repack small pack-files
32+
into larger pack-files. Scalar downloads many pack-files during the
33+
`commits-and-trees` step, or during `git checkout` commands. The `pack-files`
34+
step updates the Git multi-pack-index to improve lookup speed. Further, it
35+
combines pack-files into larger files to reduce the total pack-file count.
36+
This step is designed to work without blocking concurrent processes by only
37+
deleting pack-files after they were marked as "unused" for at least a day.
38+
This step allows using the `--batch-size=<size>` option. By default, the
39+
batch-size is "2g" for two gigabytes. This batch size signifies the goal
40+
size of a repacked pack-file.

docs/commands/scalar-upgrade.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
`scalar upgrade`
2+
================
3+
4+
The `upgrade` verb checks for the latest version of Scalar, and can allow
5+
upgrading to that version.
6+
7+
Usage
8+
-----
9+
10+
`scalar upgrade <options>`
11+
12+
Description
13+
-----------
14+
15+
Check for a new Scalar version. With `--confirm`, will perform the upgrade
16+
by downloading the new version and running the installer.
17+
18+
19+
Options
20+
-------
21+
22+
* `--confirm`: Pass in this flag to actually install the newest release.
23+
24+
* `--dry-run`: Display progress and errors, but don't install Scalar. Not
25+
compatible with the `--confirm` option.
26+
27+
* `--no-verify`: This parameter is currently required for upgrade on
28+
macOS.
29+

docs/faq.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Frequently Asked Questions
2+
==========================
3+
4+
Using Scalar
5+
------------
6+
7+
### I don't want a sparse clone, I want every file after I clone!
8+
9+
Run `scalar clone --full-clone <url>` to initialize your repo to include
10+
every file. You can switch to a sparse-checkout later by running
11+
`git sparse-checkout init --cone`.
12+
13+
### I already cloned without `--full-clone`. How do I get everything?
14+
15+
Run `git sparse-checkout disable`.
16+
17+
Scalar Design Decisions
18+
-----------------------
19+
20+
There may be many design decisions within Scalar that are confusing at first
21+
glance. Some of them may cause friction when you use Scalar with your existing
22+
repos and existing habits.
23+
24+
> Scalar has the most benefit when users design repositories
25+
> with efficient patterns.
26+
27+
For example: Scalar uses the sparse-checkout feature to limit the size of the
28+
working directory within a large monorepo. It is designed to work efficiently
29+
with monorepos that are highly componetized, allowing most developers to
30+
need many fewer files in their daily work.
31+
32+
### Why does `scalar clone` create a `<repo>/src` folder?
33+
34+
Scalar uses a file system watcher to keep track of changes under this `src` folder.
35+
Any activity in this folder is assumed to be important to Git operations. By
36+
creating the `src` folder, we are making it easy for your build system to
37+
create output folders outside the `src` directory. We commonly see systems
38+
create folders for build outputs and package downloads. Scalar itself creates
39+
these folders during its builds.
40+
41+
Your build system may create build artifacts such as `.obj` or `.lib` files
42+
next to your source code. These are commonly "hidden" from Git using
43+
`.gitignore` files. Having such artifacts into your source tree creates
44+
additional work for Git because it needs to look at these files and match them
45+
against the `.gitignore` patterns.
46+
47+
By following the pattern Scalar tries to establish and placing your build
48+
intermediates and outputs parallel with the `src` folder and not inside it,
49+
you can help optimize Git command performance for developers in the repository
50+
by limiting the number of files Git needs to consider for many common
51+
operations.

docs/index.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Scalar: Enabling Git at Scale
2+
=============================
3+
4+
Scalar is a tool that helps Git scale to some of the largest Git repositories.
5+
It achieves this by enabling some advanced Git features, such as:
6+
7+
* *Sparse-checkout:* limits the size of your working directory.
8+
9+
* *File system monitor:* tracks the recently modified files and eliminates
10+
the need for Git to scan the entire worktree.
11+
12+
* *Commit-graph:* accelerates commit walks and reachability calculations,
13+
speeding up commands like `git log`.
14+
15+
* *Multi-pack-index:* enables fast object lookups across many pack-files.
16+
17+
* *Incremental repack:* Repacks the packed Git data into fewer pack-file
18+
without disrupting concurrent commands by using the multi-pack-index.
19+
20+
Scalar clones also use the
21+
[GVFS protocol](https://github.com/microsoft//VFSForGit/blob/master/Protocol.md)
22+
to significantly reduce the amount of data required to get started
23+
using a repository. By delaying all blob downloads until they are required,
24+
Scalar allows you to work with very large repositories quickly. This protocol
25+
allows a network of _cache servers_ to serve objects with lower latency and
26+
higher throughput. The cache servers also reduce load on the central server.
27+
28+
Documentation
29+
-------------
30+
31+
* [Frequently Asked Questions](faq.md)
32+
33+
Scalar Commands
34+
---------------
35+
36+
* [`scalar clone`](commands/scalar-clone.md): Create a local enlistment of
37+
a remote repository.
38+
39+
* [`scalar upgrade`](commands/scalar-upgrade.md): Upgrade your version of
40+
Scalar to the latest available release.
41+
42+
* [`scalar diagnose`](commands/scalar-diagnose.md): Collect diagnostic data
43+
to assist troubleshooting.
44+
45+
* [`scalar maintenance`](commands/scalar-maintenance.md): Manually process
46+
Git data for efficiency. Normally run in the background by Scalar Service.
47+

0 commit comments

Comments
 (0)