Homebrew / install

📥 Homebrew (un)installer
https://brew.sh
BSD 2-Clause "Simplified" License
2.15k stars 1.02k forks source link

[performance] git fetch/clone entire repo (70Mb) vs single commit (3Mb) --depth 1 #826

Closed ReSearchITEng closed 9 months ago

ReSearchITEng commented 9 months ago

Improve the install time and bandwidth required by doing git clone only for specific branch, and only last commit.

What you were trying to do (and why)

install quickly

What happened (include command output)

git fetching the entire https://github.com/Homebrew/brew, downloads 73.55 MiB

Command output from original installation screen, not my git clone command

 ```
==> Downloading and installing Homebrew...
remote: Enumerating objects: 250543, done.
remote: Counting objects: 100% (324/324), done.
remote: Compressing objects: 100% (230/230), done.
remote: Total 250543 (delta 110), reused 269 (delta 82), pack-reused 250219
Receiving objects: 100% (250543/250543), 73.55 MiB | 11.91 MiB/s, done.
Resolving deltas: 100% (182739/182739), done.
From https://github.com/Homebrew/brew
 * [new branch]      master     -> origin/master
 * [new tag]             0.1        -> 0.1
 * [new tag]             0.2        -> 0.2
 * [new tag]             0.3        -> 0.3
 * [new tag]             0.4        -> 0.4
...
```
  

What you expected to happen

Use --depth 1 for git fetch, so it will download only last commit, instead of entire history

git clone --single-branch --branch master --depth 1 https://github.com/Homebrew/brew.git
Cloning into 'brew'...
remote: Enumerating objects: 2236, done.
remote: Counting objects: 100% (2236/2236), done.
remote: Compressing objects: 100% (1950/1950), done.
remote: Total 2236 (delta 316), reused 987 (delta 172), pack-reused 0
Receiving objects: 100% (2236/2236), 2.95 MiB | 5.00 MiB/s, done.
Resolving deltas: 100% (316/316), done.

Note that it downloaded only 2.95 MiB.

reitermarkus commented 9 months ago

Duplicate of https://github.com/Homebrew/install/issues/541.