Last active
February 26, 2021 12:00
-
-
Save rcoup/5593a0627cca52f226580c72743d8e33 to your computer and use it in GitHub Desktop.
Git: partial clone: promisor fetch during push (pack-objects)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ git --version | |
git version 2.30.1.602.g966e671106 | |
+ uname -a | |
Darwin otata 19.6.0 Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64 x86_64 i386 MacBookPro11,1 Darwin | |
+ rm -rf ./SK.local.git ./SK.remote.git | |
+ git clone --bare https://github.com/octocat/Spoon-Knife SK.remote.git | |
Cloning into bare repository 'SK.remote.git'... | |
warning: templates not found in /Users/rcoup/share/git-core/templates | |
remote: Enumerating objects: 16, done. | |
remote: Total 16 (delta 0), reused 0 (delta 0), pack-reused 16 | |
Receiving objects: 100% (16/16), done. | |
Resolving deltas: 100% (3/3), done. | |
+ git -C SK.remote.git config uploadpack.allowFilter true | |
+ git -C SK.remote.git config uploadpack.allowAnySHA1InWant false | |
++ pwd | |
+ REMOTE_URL=file:///Users/rcoup/code/git/rc-test-data/SK.remote.git | |
+ git clone --bare --filter=blob:none file:///Users/rcoup/code/git/rc-test-data/SK.remote.git SK.local.git | |
Cloning into bare repository 'SK.local.git'... | |
warning: templates not found in /Users/rcoup/share/git-core/templates | |
remote: Enumerating objects: 10, done. | |
remote: Counting objects: 100% (10/10), done. | |
remote: Compressing objects: 100% (8/8), done. | |
remote: Total 10 (delta 1), reused 10 (delta 1), pack-reused 0 | |
Receiving objects: 100% (10/10), done. | |
Resolving deltas: 100% (1/1), done. | |
+ cd SK.local.git | |
+ git config remote.origin.url file:///dev/null | |
+ git ls-tree HEAD | |
100644 blob f4790267d0d362a90d6799759ece092616c40779 README.md | |
100644 blob a83618bcf17b4e8e643de75d09adc0e892043020 index.html | |
100644 blob 9b8528455cf79bca41ac100bcb531fcbf580985e styles.css | |
++ git rev-parse HEAD | |
+ OLD_HEAD=d0dd1f61b33d64e29d8bc1372a94ef6a2fee76a9 | |
++ git hash-object -w --stdin | |
+ NEW_BLOB=4be557ed63be643afaf898197f7dcbabb37630f1 | |
# prevent mktree from doing a fetch, since it seemingly wants to regardless of --missing | |
+ git config --unset remote.origin.promisor | |
++ git mktree --missing | |
++ echo -e '100644 blob 4be557ed63be643afaf898197f7dcbabb37630f1\tREADME.md' | |
++ git ls-tree HEAD | |
++ tail -n +2 | |
fatal: '/dev/null' does not appear to be a git repository | |
fatal: Could not read from remote repository. | |
Please make sure you have the correct access rights | |
and the repository exists. | |
fatal: '/dev/null' does not appear to be a git repository | |
fatal: Could not read from remote repository. | |
Please make sure you have the correct access rights | |
and the repository exists. | |
+ NEW_TREE=7a4137f2102b4ef4b042e9748023288fab3fe0b4 | |
++ echo 'Yakka dee' | |
++ git commit-tree 7a4137f2102b4ef4b042e9748023288fab3fe0b4 -p d0dd1f61b33d64e29d8bc1372a94ef6a2fee76a9 | |
+ NEW_COMMIT=32c825a9fb996340c16a3e2a112e8bf4f1a63efb | |
+ git update-ref refs/heads/main 32c825a9fb996340c16a3e2a112e8bf4f1a63efb | |
+ git ls-tree refs/heads/main | |
100644 blob 4be557ed63be643afaf898197f7dcbabb37630f1 README.md | |
100644 blob a83618bcf17b4e8e643de75d09adc0e892043020 index.html | |
100644 blob 9b8528455cf79bca41ac100bcb531fcbf580985e styles.css | |
+ git config remote.origin.promisor true | |
+ export GIT_TRACE=1 | |
+ GIT_TRACE=1 | |
# What I actually want to run is `git push`, which does a fetch... | |
# Do it at the end to demonstrate pack-objects behaviour | |
# tries to fetch | |
+ echo d0dd1f61b33d64e29d8bc1372a94ef6a2fee76a9..32c825a9fb996340c16a3e2a112e8bf4f1a63efb | |
+ git pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress | |
+ git unpack-objects -n | |
11:07:41.525395 git.c:447 trace: built-in: git unpack-objects -n | |
11:07:41.526758 git.c:447 trace: built-in: git pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress | |
Enumerating objects: 5, done. | |
11:07:41.529805 run-command.c:667 trace: run_command: git -c fetch.negotiationAlgorithm=noop fetch origin --no-tags --no-write-fetch-head --recurse-submodules=no --filter=blob:none --stdin | |
11:07:41.538096 git.c:447 trace: built-in: git fetch origin --no-tags --no-write-fetch-head --recurse-submodules=no --filter=blob:none --stdin | |
11:07:41.539890 run-command.c:667 trace: run_command: unset GIT_CONFIG_PARAMETERS GIT_DIR GIT_IMPLICIT_WORK_TREE GIT_PREFIX; GIT_PROTOCOL=version=2 'git-upload-pack '\''/dev/null'\''' | |
11:07:41.555561 git.c:447 trace: built-in: git upload-pack /dev/null | |
fatal: '/dev/null' does not appear to be a git repository | |
fatal: Could not read from remote repository. | |
Please make sure you have the correct access rights | |
and the repository exists. | |
Counting objects: 100% (5/5), done. | |
Delta compression using up to 4 threads | |
Compressing objects: 100% (3/3), done. | |
Writing objects: 100% (3/3), 736.55 KiB | 3.23 MiB/s, done. | |
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 | |
Unpacking objects: 100% (3/3), 736.53 KiB | 49.10 MiB/s, done. | |
# so does this (for any value of --missing=) | |
+ echo d0dd1f61b33d64e29d8bc1372a94ef6a2fee76a9..32c825a9fb996340c16a3e2a112e8bf4f1a63efb | |
+ git pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress --missing=allow-any | |
+ git unpack-objects -n | |
11:07:41.806533 git.c:447 trace: built-in: git pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress --missing=allow-any | |
Enumerating objects: 5, done. | |
11:07:41.812889 run-command.c:667 trace: run_command: git -c fetch.negotiationAlgorithm=noop fetch origin --no-tags --no-write-fetch-head --recurse-submodules=no --filter=blob:none --stdin | |
11:07:41.812829 git.c:447 trace: built-in: git unpack-objects -n | |
11:07:41.825654 git.c:447 trace: built-in: git fetch origin --no-tags --no-write-fetch-head --recurse-submodules=no --filter=blob:none --stdin | |
11:07:41.829374 run-command.c:667 trace: run_command: unset GIT_CONFIG_PARAMETERS GIT_DIR GIT_IMPLICIT_WORK_TREE GIT_PREFIX; GIT_PROTOCOL=version=2 'git-upload-pack '\''/dev/null'\''' | |
11:07:41.848716 git.c:447 trace: built-in: git upload-pack /dev/null | |
fatal: '/dev/null' does not appear to be a git repository | |
fatal: Could not read from remote repository. | |
Please make sure you have the correct access rights | |
and the repository exists. | |
Counting objects: 100% (5/5), done. | |
Delta compression using up to 4 threads | |
Compressing objects: 100% (3/3), done. | |
Writing objects: 100% (3/3), 736.55 KiB | 3.26 MiB/s, done. | |
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 | |
Unpacking objects: 100% (3/3), 736.53 KiB | 52.61 MiB/s, done. | |
# this doesn't | |
+ echo d0dd1f61b33d64e29d8bc1372a94ef6a2fee76a9..32c825a9fb996340c16a3e2a112e8bf4f1a63efb | |
+ git -c pack.window=0 pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress --missing=allow-any | |
+ git unpack-objects -n | |
11:07:42.099332 git.c:447 trace: built-in: git unpack-objects -n | |
11:07:42.100011 git.c:447 trace: built-in: git pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress --missing=allow-any | |
Enumerating objects: 3, done. | |
Counting objects: 100% (3/3), done. | |
Writing objects: 100% (3/3), 736.55 KiB | 2.33 MiB/s, done. | |
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 | |
Unpacking objects: 100% (3/3), 736.53 KiB | 52.61 MiB/s, done. | |
# What I actually want to run. | |
# This does a fetch... | |
+ git config remote.origin.url file:///Users/rcoup/code/git/rc-test-data/SK.remote.git | |
11:07:42.426521 git.c:447 trace: built-in: git config remote.origin.url file:///Users/rcoup/code/git/rc-test-data/SK.remote.git | |
+ git push origin main | |
11:07:42.440650 git.c:447 trace: built-in: git push origin main | |
11:07:42.441911 run-command.c:667 trace: run_command: unset GIT_DIR GIT_IMPLICIT_WORK_TREE GIT_PREFIX; 'git-receive-pack '\''/Users/rcoup/code/git/rc-test-data/SK.remote.git'\''' | |
11:07:42.456123 git.c:447 trace: built-in: git receive-pack /Users/rcoup/code/git/rc-test-data/SK.remote.git | |
11:07:42.458678 run-command.c:667 trace: run_command: git pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress | |
11:07:42.468836 git.c:447 trace: built-in: git pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress | |
Enumerating objects: 5, done. | |
11:07:42.471562 run-command.c:667 trace: run_command: git -c fetch.negotiationAlgorithm=noop fetch origin --no-tags --no-write-fetch-head --recurse-submodules=no --filter=blob:none --stdin | |
11:07:42.482331 git.c:447 trace: built-in: git fetch origin --no-tags --no-write-fetch-head --recurse-submodules=no --filter=blob:none --stdin | |
11:07:42.484027 run-command.c:667 trace: run_command: unset GIT_CONFIG_PARAMETERS GIT_DIR GIT_IMPLICIT_WORK_TREE GIT_PREFIX; GIT_PROTOCOL=version=2 'git-upload-pack '\''/Users/rcoup/code/git/rc-test-data/SK.remote.git'\''' | |
11:07:42.497197 git.c:447 trace: built-in: git upload-pack /Users/rcoup/code/git/rc-test-data/SK.remote.git | |
11:07:42.500756 run-command.c:667 trace: run_command: git pack-objects --revs --thin --stdout --progress --delta-base-offset --filter=blob:none | |
remote: 11:07:42.517759 git.c:447 trace: built-in: git pack-objects --revs --thin --stdout --progress --delta-base-offset --filter=blob:none | |
remote: Enumerating objects: 1, done. | |
remote: Counting objects: 100% (1/1), done. | |
11:07:42.520765 run-command.c:667 trace: run_command: git index-pack --stdin -v --fix-thin --promisor --pack_header=2,1 | |
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0 | |
11:07:42.530822 git.c:447 trace: built-in: git index-pack --stdin -v --fix-thin --promisor --pack_header=2,1 | |
Receiving objects: 100% (1/1), 467 bytes | 467.00 KiB/s, done. | |
11:07:42.537394 run-command.c:667 trace: run_command: git maintenance run --auto --no-quiet | |
11:07:42.549135 git.c:447 trace: built-in: git maintenance run --auto --no-quiet | |
Counting objects: 100% (5/5), done. | |
Delta compression using up to 4 threads | |
Compressing objects: 100% (3/3), done. | |
11:07:42.755778 run-command.c:667 trace: run_command: GIT_ALTERNATE_OBJECT_DIRECTORIES=/Users/rcoup/code/git/rc-test-data/SK.remote.git/./objects GIT_OBJECT_DIRECTORY=/Users/rcoup/code/git/rc-test-data/SK.remote.git/./objects/incoming-1pRQ8p GIT_QUARANTINE_PATH=/Users/rcoup/code/git/rc-test-data/SK.remote.git/./objects/incoming-1pRQ8p git unpack-objects --pack_header=2,3 | |
remote: 11:07:42.765085 git.c:447 trace: built-in: git unpack-objects --pack_header=2,3 | |
Writing objects: 100% (3/3), 736.55 KiB | 3.13 MiB/s, done. | |
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 | |
11:07:42.844721 run-command.c:667 trace: run_command: GIT_ALTERNATE_OBJECT_DIRECTORIES=/Users/rcoup/code/git/rc-test-data/SK.remote.git/./objects GIT_OBJECT_DIRECTORY=/Users/rcoup/code/git/rc-test-data/SK.remote.git/./objects/incoming-1pRQ8p GIT_QUARANTINE_PATH=/Users/rcoup/code/git/rc-test-data/SK.remote.git/./objects/incoming-1pRQ8p git rev-list --objects --stdin --not --all --quiet --alternate-refs '--progress=Checking connectivity' | |
remote: 11:07:42.852933 git.c:447 trace: built-in: git rev-list --objects --stdin --not --all --quiet --alternate-refs '--progress=Checking connectivity' | |
remote: 11:07:42.855272 run-command.c:667 trace: run_command: unset GIT_ALTERNATE_OBJECT_DIRECTORIES GIT_DIR GIT_OBJECT_DIRECTORY GIT_PREFIX; git --git-dir=/Users/rcoup/code/git/rc-test-data/SK.remote.git for-each-ref '--format=%(objectname)' | |
remote: 11:07:42.866388 git.c:447 trace: built-in: git for-each-ref '--format=%(objectname)' | |
11:07:42.882768 run-command.c:667 trace: run_command: git gc --auto --quiet | |
remote: 11:07:42.891868 git.c:447 trace: built-in: git gc --auto --quiet | |
To file:///Users/rcoup/code/git/rc-test-data/SK.remote.git | |
d0dd1f6..32c825a main -> main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -exu | |
git --version; uname -a | |
rm -rf ./SK.*.git | |
git clone --bare https://github.com/octocat/Spoon-Knife SK.remote.git | |
git -C SK.remote.git config uploadpack.allowFilter true | |
git -C SK.remote.git config uploadpack.allowAnySHA1InWant false | |
REMOTE_URL="file://$(pwd)/SK.remote.git" | |
git clone --bare --filter=blob:none "${REMOTE_URL}" SK.local.git | |
cd SK.local.git | |
# make fetches fail | |
git config remote.origin.url "file:///dev/null" | |
git ls-tree HEAD | |
OLD_HEAD=$(git rev-parse HEAD) | |
NEW_BLOB=$(git hash-object -w --stdin </usr/share/dict/words) | |
# prevent mktree from doing a fetch, since it seemingly wants to regardless of --missing | |
git config --unset remote.origin.promisor | |
NEW_TREE=$( | |
( | |
echo -e "100644 blob ${NEW_BLOB}\tREADME.md" | |
git ls-tree HEAD | tail -n +2 | |
) | git mktree --missing | |
) | |
NEW_COMMIT=$(echo "Yakka dee" | git commit-tree "${NEW_TREE}" -p "${OLD_HEAD}") | |
git update-ref refs/heads/main "${NEW_COMMIT}" | |
git ls-tree refs/heads/main | |
# re-enable the promisor | |
git config remote.origin.promisor true | |
export GIT_TRACE=1 | |
# What I actually want to run is `git push`, which does a fetch... | |
# Do it at the end to demonstrate pack-objects behaviour | |
# tries to fetch | |
echo "${OLD_HEAD}..${NEW_COMMIT}" \ | |
| git pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress | git unpack-objects -n | |
# so does this (for any value of --missing=) | |
echo "${OLD_HEAD}..${NEW_COMMIT}" \ | |
| git pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress --missing=allow-any | git unpack-objects -n | |
# this doesn't | |
echo "${OLD_HEAD}..${NEW_COMMIT}" \ | |
| git -c 'pack.window=0' pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress --missing=allow-any | git unpack-objects -n | |
# What I actually want to run. | |
# This does a fetch... | |
git config remote.origin.url "${REMOTE_URL}" | |
git push origin main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment