Skip to content

Instantly share code, notes, and snippets.

@lavoiesl
Created November 22, 2018 15:57
Show Gist options
  • Save lavoiesl/4ff24ee67b0bcaacb03816ba1144c131 to your computer and use it in GitHub Desktop.
Save lavoiesl/4ff24ee67b0bcaacb03816ba1144c131 to your computer and use it in GitHub Desktop.
reference vs clone
```
$ time GIT_TRACE=1 git -c http.proxy=http://localhost:8888 clone --mirror https://github.com/Shopify/shopify.git /tmp/g.git
10:45:42.059182 git.c:415 trace: built-in: git clone --mirror https://github.com/Shopify/shopify.git /tmp/g.git
Cloning into bare repository '/tmp/g.git'...
10:45:42.071336 run-command.c:637 trace: run_command: git-remote-galaxy origin Shopify/shopify.git
10:45:42.152772 git.c:415 trace: built-in: git config --get remote.origin.url
10:45:42.168087 git.c:415 trace: built-in: git config --get remote.origin.pushurl
10:45:42.193176 git.c:415 trace: built-in: git config --get user.email
10:45:42.199199 git.c:659 trace: exec: git-remote-http origin https://git-mirror.shopifycloud.com/Shopify/shopify.git
10:45:42.199637 run-command.c:637 trace: run_command: git-remote-http origin https://git-mirror.shopifycloud.com/Shopify/shopify.git
10:45:42.471483 run-command.c:637 trace: run_command: 'git credential-osxkeychain get'
10:45:42.481018 git.c:659 trace: exec: git-credential-osxkeychain get
10:45:42.481703 run-command.c:637 trace: run_command: git-credential-osxkeychain get
10:45:42.719153 run-command.c:637 trace: run_command: 'git credential-osxkeychain store'
10:45:42.729719 git.c:659 trace: exec: git-credential-osxkeychain store
10:45:42.731564 run-command.c:637 trace: run_command: git-credential-osxkeychain store
10:47:38.634692 run-command.c:637 trace: run_command: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 50325 on phlebotome.local' --check-self-contained-and-connected
10:47:38.642159 git.c:415 trace: built-in: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 50325 on phlebotome.local' --check-self-contained-and-connected
remote: Enumerating objects: 3715943, done.
remote: Counting objects: 100% (3715943/3715943), done.
remote: Compressing objects: 100% (707584/707584), done.
remote: Total 3715943 (delta 2941077), reused 3710324 (delta 2936155)
Receiving objects: 100% (3715943/3715943), 1.45 GiB | 20.82 MiB/s, done.
Resolving deltas: 100% (2941077/2941077), done.
10:50:56.541986 run-command.c:637 trace: run_command: git rev-list --objects --stdin --not --all --quiet '--progress=Checking connectivity'
10:50:56.548158 git.c:415 trace: built-in: git rev-list --objects --stdin --not --all --quiet '--progress=Checking connectivity'
GIT_TRACE=1 git -c http.proxy=http://localhost:8888 clone --mirror /tmp/g.gi 133.49s user 42.71s system 55% cpu 5:14.77 total
```
"2" requests, 4 minutes of fetching:
```
https://git-mirror.shopifycloud.com/Shopify/shopify.git/info/refs?service=git-upload-pack 401 GET git-mirror.shopifycloud.com /Shopify/shopify.git/info/refs?service=git-upload-pack Thu Nov 22 10:45:42 EST 2018 36 686 Complete
https://git-mirror.shopifycloud.com/Shopify/shopify.git/info/refs?service=git-upload-pack 200 GET git-mirror.shopifycloud.com /Shopify/shopify.git/info/refs?service=git-upload-pack Thu Nov 22 10:45:42 EST 2018 204 1019 Complete
https://git-mirror.shopifycloud.com/Shopify/shopify.git/git-upload-pack 200 POST git-mirror.shopifycloud.com /Shopify/shopify.git/git-upload-pack Thu Nov 22 10:45:42 EST 2018 1848 372468 Complete
https://git-mirror.shopifycloud.com/Shopify/shopify.git/git-upload-pack 200 POST git-mirror.shopifycloud.com /Shopify/shopify.git/git-upload-pack Thu Nov 22 10:45:44 EST 2018 263159 1560414902 Complete
```
```
$ time GIT_TRACE=1 git clone --mirror --no-local shopify /tmp/g.git
10:54:54.187114 git.c:415 trace: built-in: git clone --mirror --no-local shopify /tmp/g.git
Cloning into bare repository '/tmp/g.git'...
10:54:54.197391 run-command.c:637 trace: run_command: unset GIT_DIR; GIT_PROTOCOL=version=2 'git-upload-pack '\''/Users/seb/src/github.com/Shopify/shopify'\'''
10:54:54.204180 git.c:415 trace: built-in: git upload-pack /Users/seb/src/github.com/Shopify/shopify
10:54:54.548095 run-command.c:637 trace: run_command: git pack-objects --revs --thin --stdout --progress --delta-base-offset
10:54:54.548201 run-command.c:637 trace: run_command: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 55833 on phlebotome.local' --check-self-contained-and-connected
10:54:54.553224 git.c:415 trace: built-in: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 55833 on phlebotome.local' --check-self-contained-and-connected
remote: 10:54:54.553251 git.c:415 trace: built-in: git pack-objects --revs --thin --stdout --progress --delta-base-offset
remote: Enumerating objects: 3730706, done.
remote: Counting objects: 100% (3730706/3730706), done.
remote: Compressing objects: 100% (753471/753471), done.
Receiving objects: 100% (3730706/3730706), 1.46 GiB | 40.94 MiB/s, done.
remote: Total 3730706 (delta 2948477), reused 3680697 (delta 2904599)
Resolving deltas: 100% (2948477/2948477), done.
10:57:27.566314 run-command.c:637 trace: run_command: git rev-list --objects --stdin --not --all --quiet '--progress=Checking connectivity'
10:57:27.573359 git.c:415 trace: built-in: git rev-list --objects --stdin --not --all --quiet '--progress=Checking connectivity'
GIT_TRACE=1 git clone --mirror --no-local shopify /tmp/g.git 168.95s user 47.90s system 140% cpu 2:34.00 total
```
```
$ time GIT_TRACE=1 git -c http.proxy=http://localhost:8888 clone --mirror --reference shopify --dissociate https://github.com/Shopify/shopify.git /tmp/g.git
10:38:45.140085 git.c:415 trace: built-in: git clone --mirror --reference shopify --dissociate https://github.com/Shopify/shopify.git /tmp/g.git
Cloning into bare repository '/tmp/g.git'...
10:38:45.149753 run-command.c:637 trace: run_command: git-remote-galaxy origin Shopify/shopify.git
10:38:45.229550 git.c:415 trace: built-in: git config --get remote.origin.url
10:38:45.248047 git.c:415 trace: built-in: git config --get remote.origin.pushurl
10:38:45.278976 git.c:415 trace: built-in: git config --get user.email
10:38:45.285632 git.c:659 trace: exec: git-remote-http origin https://git-mirror.shopifycloud.com/Shopify/shopify.git
10:38:45.286228 run-command.c:637 trace: run_command: git-remote-http origin https://git-mirror.shopifycloud.com/Shopify/shopify.git
10:38:45.585349 run-command.c:637 trace: run_command: 'git credential-osxkeychain get'
10:38:45.597201 git.c:659 trace: exec: git-credential-osxkeychain get
10:38:45.598079 run-command.c:637 trace: run_command: git-credential-osxkeychain get
10:38:45.663910 run-command.c:637 trace: run_command: 'git credential-osxkeychain store'
10:38:45.671984 git.c:659 trace: exec: git-credential-osxkeychain store
10:38:45.672533 run-command.c:637 trace: run_command: git-credential-osxkeychain store
10:38:47.153132 run-command.c:637 trace: run_command: unset GIT_CONFIG_PARAMETERS GIT_DIR; git --git-dir=/Users/seb/src/github.com/Shopify/shopify/.git for-each-ref '--format=%(objectname) %(refname)'
10:38:47.157995 git.c:415 trace: built-in: git for-each-ref '--format=%(objectname) %(refname)'
10:38:47.337825 run-command.c:637 trace: run_command: git rev-list --objects --stdin --not --all --quiet '--progress=Checking connectivity'
10:38:47.342550 git.c:415 trace: built-in: git rev-list --objects --stdin --not --all --quiet '--progress=Checking connectivity'
Checking connectivity: 3715932, done.
10:39:22.305414 run-command.c:637 trace: run_command: git repack -a -d
10:39:22.311091 git.c:415 trace: built-in: git repack -a -d
10:39:22.312865 run-command.c:637 trace: run_command: git pack-objects --delta-base-offset /private/tmp/g.git/objects/pack/.tmp-46538-pack --keep-true-parents --honor-pack-keep --non-empty --all --reflog --indexed-objects
10:39:22.317048 git.c:415 trace: built-in: git pack-objects --delta-base-offset /private/tmp/g.git/objects/pack/.tmp-46538-pack --keep-true-parents --honor-pack-keep --non-empty --all --reflog --indexed-objects
Enumerating objects: 3715932, done.
Counting objects: 100% (3715932/3715932), done.
Delta compression using up to 8 threads
Compressing objects: 100% (750014/750014), done.
Writing objects: 100% (3715932/3715932), done.
Total 3715932 (delta 2936710), reused 3666824 (delta 2893714)
GIT_TRACE=1 git -c http.proxy=http://localhost:8888 clone --mirror --referenc 104.25s user 10.57s system 102% cpu 1:51.58 total
```
Only "1" 1.2s request
```
https://git-mirror.shopifycloud.com/Shopify/shopify.git/info/refs?service=git-upload-pack 401 GET git-mirror.shopifycloud.com /Shopify/shopify.git/info/refs?service=git-upload-pack Thu Nov 22 10:38:45 EST 2018 35 686 Complete
https://git-mirror.shopifycloud.com/Shopify/shopify.git/info/refs?service=git-upload-pack 200 GET git-mirror.shopifycloud.com /Shopify/shopify.git/info/refs?service=git-upload-pack Thu Nov 22 10:38:45 EST 2018 40 1019 Complete
https://git-mirror.shopifycloud.com/Shopify/shopify.git/git-upload-pack 200 POST git-mirror.shopifycloud.com /Shopify/shopify.git/git-upload-pack Thu Nov 22 10:38:45 EST 2018 1266 372393 Complete
```
@Azhng
Copy link

Azhng commented Nov 22, 2018

I don't know what I am doing wrong but seems like my --reference clone from the remote takes way longer than yours

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment