git: cbe1572983 - main - Reduce depth of git pull when checking out ports

From: Benedict Reuschling <bcr_at_FreeBSD.org>
Date: Wed, 29 May 2024 15:24:09 UTC
The branch main has been updated by bcr:

URL: https://cgit.FreeBSD.org/doc/commit/?id=cbe1572983c139a36fb0357e16df0dd01e1318ad

commit cbe1572983c139a36fb0357e16df0dd01e1318ad
Author:     Benedict Reuschling <bcr@FreeBSD.org>
AuthorDate: 2024-05-29 15:19:28 +0000
Commit:     Benedict Reuschling <bcr@FreeBSD.org>
CommitDate: 2024-05-29 15:19:28 +0000

    Reduce depth of git pull when checking out ports
    
    An initial 'git clone' of the ports tree takes a long time. The checkout we
    had before this change contained all the commit history, which would
    normally not be necessary nor be interesting for people who simply want
    to compile ports without doing any kind of development.
    
    To reduce the clone time add the '--depth 1' parameter in this change.
    Additionally, for people that do work on ports, a sentence about
    removing that option was added.
---
 documentation/content/en/books/handbook/ports/_index.adoc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/documentation/content/en/books/handbook/ports/_index.adoc b/documentation/content/en/books/handbook/ports/_index.adoc
index 7ef3b47c7d..a32b0608ba 100644
--- a/documentation/content/en/books/handbook/ports/_index.adoc
+++ b/documentation/content/en/books/handbook/ports/_index.adoc
@@ -680,6 +680,9 @@ If more control over the ports tree is needed or if local changes need to be mai
 Git can be used to obtain the Ports Collection.
 Refer to extref:{committers-guide}[the Git Primer, git-primer] for a detailed description of Git.
 
+We add --depth 1 to the git command line to clone the tree without obtaining the commit history, which saves time and is acceptable for most users. 
+If you have your own changes to the ports tree, or need the history for any reason, omit the --depth 1 argument below.
+
 . Git must be installed before it can be used to check out the ports tree. If a copy of the ports tree is already present, install Git like this:
 +
 [source,shell]
@@ -699,14 +702,14 @@ If the ports tree is not available, or pkg is being used to manage packages, Git
 +
 [source,shell]
 ....
-# git clone https://git.FreeBSD.org/ports.git /usr/ports
+# git clone --depth 1 https://git.FreeBSD.org/ports.git /usr/ports
 ....
 +
 . Or, check out a copy of a quarterly branch:
 +
 [source,shell]
 ....
-# git clone https://git.FreeBSD.org/ports.git -b 2023Q1 /usr/ports
+# git clone --depth 1 https://git.FreeBSD.org/ports.git -b 2023Q1 /usr/ports
 ....
 +
 . As needed, update `/usr/ports` after the initial Git checkout: