Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t5501-fetch-push-alternates.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t5501-fetch-push-alternates.sh` 69 lines ยท 1393 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='fetch/push involving alternates' 4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 6 7 . ./test-lib.sh 8 9 count_objects () { 10 loose=0 inpack=0 11 eval "$( 12 git count-objects -v | 13 sed -n -e 's/^count: \(.*\)/loose=\1/p' \ 14 -e 's/^in-pack: \(.*\)/inpack=\1/p' 15 )" && 16 echo $(( $loose + $inpack )) 17 } 18 19 20 test_expect_success setup ' 21 ( 22 git init original && 23 cd original && 24 i=0 && 25 while test $i -le 100 26 do 27 echo "$i" >count && 28 git add count && 29 git commit -m "$i" || exit 30 i=$(($i + 1)) 31 done 32 ) && 33 ( 34 git clone --reference=original "file://$(pwd)/original" one && 35 cd one && 36 echo Z >count && 37 git add count && 38 git commit -m Z && 39 count_objects >../one.count 40 ) && 41 A=$(pwd)/original/.git/objects && 42 git init receiver && 43 echo "$A" >receiver/.git/objects/info/alternates && 44 git init fetcher && 45 echo "$A" >fetcher/.git/objects/info/alternates 46 ' 47 48 test_expect_success 'pushing into a repository with the same alternate' ' 49 ( 50 cd one && 51 git push ../receiver main:refs/heads/it 52 ) && 53 ( 54 cd receiver && 55 count_objects >../receiver.count 56 ) && 57 test_cmp one.count receiver.count 58 ' 59 60 test_expect_success 'fetching from a repository with the same alternate' ' 61 ( 62 cd fetcher && 63 git fetch ../one main:refs/heads/it && 64 count_objects >../fetcher.count 65 ) && 66 test_cmp one.count fetcher.count 67 ' 68 69 test_done