From eb9eb7ca80b0933025581665f9747036e59b5d2b Mon Sep 17 00:00:00 2001 From: y21 <30553356+y21@users.noreply.github.com> Date: Wed, 5 Apr 2023 22:44:23 +0200 Subject: [PATCH 1/2] mention `git clone --depth` --- src/building/how-to-build-and-run.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/building/how-to-build-and-run.md b/src/building/how-to-build-and-run.md index ffb93f6b2..1475dc62c 100644 --- a/src/building/how-to-build-and-run.md +++ b/src/building/how-to-build-and-run.md @@ -24,6 +24,27 @@ git clone https://github.com/rust-lang/rust.git cd rust ``` +### Shallow clone the repository + +Due to the size of the repository, cloning on a slower internet connection can take a long time. +To sidestep this, you can use the `--depth N` option with the `git clone` command. +This instructs `git` to perform a "shallow clone", cloning the repository but truncating it to the last `N` commits. + +Passing `--depth 1` tells `git` to clone the repository but truncate the history to the latest commit +that is on the `master` branch, which is usually fine for browsing the source code or building the compiler. + +```bash +git clone --depth 1 https://github.com/rust-lang/rust.git +cd rust +``` + +> **NOTE**: A shallow clone limits which `git` commands can be run. +> If you intend to work on and contribute to the compiler, it is +> generally recommended to fully clone the repository [as shown above](#get-the-source-code). +> +> For example, `git bisect` and `git blame` require access to the commit history, +> so they don't work if the repository was cloned with `--depth 1`. + ## What is `x.py`? `x.py` is the build tool for the `rust` repository. It can build docs, run tests, and compile the From 2d0bf500e70ffbee20f3e1c4fb9b6a51f0769661 Mon Sep 17 00:00:00 2001 From: y21 <30553356+y21@users.noreply.github.com> Date: Wed, 5 Apr 2023 22:49:12 +0200 Subject: [PATCH 2/2] fix line length --- src/building/how-to-build-and-run.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/building/how-to-build-and-run.md b/src/building/how-to-build-and-run.md index 1475dc62c..59893bdc1 100644 --- a/src/building/how-to-build-and-run.md +++ b/src/building/how-to-build-and-run.md @@ -28,10 +28,12 @@ cd rust Due to the size of the repository, cloning on a slower internet connection can take a long time. To sidestep this, you can use the `--depth N` option with the `git clone` command. -This instructs `git` to perform a "shallow clone", cloning the repository but truncating it to the last `N` commits. +This instructs `git` to perform a "shallow clone", cloning the repository but truncating it to +the last `N` commits. -Passing `--depth 1` tells `git` to clone the repository but truncate the history to the latest commit -that is on the `master` branch, which is usually fine for browsing the source code or building the compiler. +Passing `--depth 1` tells `git` to clone the repository but truncate the history to the latest +commit that is on the `master` branch, which is usually fine for browsing the source code or +building the compiler. ```bash git clone --depth 1 https://github.com/rust-lang/rust.git