git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob b66efcdce98463c12572d65834228d83eef0ddb2 4014 bytes (raw)
name: t/t5318-midx.sh 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
 
#!/bin/sh

test_description='multi-pack indexes'
. ./test-lib.sh

test_expect_success 'config' \
    'rm -rf .git &&
     mkdir full &&
     cd full &&
     git init &&
     git config core.midx true &&
     git config pack.threads 1 &&
     packdir=.git/objects/pack'

test_expect_success 'write-midx with no packs' \
    'midx0=$(git midx --write) &&
     test "a$midx0" = "a"'

test_expect_success 'create objects' \
    'for i in $(test_seq 100)
     do
         echo $i >file-1-$i
     done &&
     git add file-* &&
     test_tick &&
     git commit -m "test data 1" &&
     git branch commit1 HEAD'

test_expect_success 'write-midx from index version 1' \
    'pack1=$(git rev-list --all --objects | git pack-objects --index-version=1 ${packdir}/test-1) &&
     midx1=$(git midx --write) &&
     test_path_is_file ${packdir}/midx-${midx1}.midx &&
     test_path_is_missing ${packdir}/midx-head'

test_expect_success 'write-midx from index version 2' \
    'rm "${packdir}/test-1-${pack1}.pack" &&
     pack2=$(git rev-list --all --objects | git pack-objects --index-version=2 ${packdir}/test-2) &&
     midx2=$(git midx --write --update-head) &&
     test_path_is_file ${packdir}/midx-${midx2}.midx &&
     test_path_is_file ${packdir}/midx-head &&
     test $(cat ${packdir}/midx-head) = "$midx2"'

test_expect_success 'Create more objects' \
    'for i in $(test_seq 100)
     do
         echo $i >file-2-$i
     done &&
     git add file-* &&
     test_tick &&
     git commit -m "test data 2" &&
     git branch commit2 HEAD'

test_expect_success 'write-midx with two packs' \
    'pack3=$(git rev-list --objects commit2 ^commit1 | git pack-objects --index-version=2 ${packdir}/test-3) &&
     midx3=$(git midx --write --update-head) &&
     test_path_is_file ${packdir}/midx-${midx3}.midx &&
     test_path_is_file ${packdir}/midx-head &&
     test $(cat ${packdir}/midx-head) = "$midx3"'

test_expect_success 'Add more packs' \
    'for j in $(test_seq 10)
     do
         jjj=$(printf '%03i' $j)
         test-genrandom "bar" 200 > wide_delta_$jjj &&
         test-genrandom "baz $jjj" 50 >> wide_delta_$jjj &&
         test-genrandom "foo"$j 100 > deep_delta_$jjj &&
         test-genrandom "foo"$(expr $j + 1) 100 >> deep_delta_$jjj &&
         test-genrandom "foo"$(expr $j + 2) 100 >> deep_delta_$jjj &&
         echo $jjj >file_$jjj &&
         test-genrandom "$jjj" 8192 >>file_$jjj &&
         git update-index --add file_$jjj deep_delta_$jjj wide_delta_$jjj &&
         { echo 101 && test-genrandom 100 8192; } >file_101 &&
         git update-index --add file_101 &&
         commit=$(git commit-tree $EMPTY_TREE -p HEAD</dev/null) && {
         echo $EMPTY_TREE &&
         git ls-tree $EMPTY_TREE | sed -e "s/.* \\([0-9a-f]*\\)	.*/\\1/"
         } >obj-list &&
         echo commit_packs_$j = $commit &&
	 git branch commit_packs_$j $commit &&
         git update-ref HEAD $commit &&
         git pack-objects --index-version=2 ${packdir}/test-pack <obj-list
     done'

test_expect_success 'write-midx with twelve packs' \
    'midx4=$(git midx --write --update-head) &&
     test_path_is_file ${packdir}/midx-${midx4}.midx &&
     test_path_is_file ${packdir}/midx-head &&
     test $(cat ${packdir}/midx-head) = "$midx4"'

test_expect_success 'write-midx with no new packs' \
    'midx5=$(git midx --write --update-head) &&
     test_path_is_file ${packdir}/midx-${midx5}.midx &&
     test "a$midx4" = "a$midx5" &&
     test_path_is_file ${packdir}/midx-head &&
     test $(cat ${packdir}/midx-head) = "$midx4"'

test_expect_success 'create bare repo' \
    'cd .. &&
     git clone --bare full bare &&
     cd bare &&
     git config core.midx true &&
     git config pack.threads 1 &&
     baredir=objects/pack'

test_expect_success 'write-midx in bare repo' \
    'midxbare=$(git midx --write --update-head) &&
     test_path_is_file ${baredir}/midx-${midxbare}.midx  &&
     test_path_is_file ${baredir}/midx-head &&
     test $(cat ${baredir}/midx-head) = "$midxbare"'

test_done

debug log:

solving b66efcdce9 ...
found b66efcdce9 in https://public-inbox.org/git/20180107181459.222909-8-dstolee@microsoft.com/
found 869bbea29c in https://public-inbox.org/git/20180107181459.222909-7-dstolee@microsoft.com/

applying [1/2] https://public-inbox.org/git/20180107181459.222909-7-dstolee@microsoft.com/
diff --git a/t/t5318-midx.sh b/t/t5318-midx.sh
new file mode 100755
index 0000000000..869bbea29c


applying [2/2] https://public-inbox.org/git/20180107181459.222909-8-dstolee@microsoft.com/
diff --git a/t/t5318-midx.sh b/t/t5318-midx.sh
index 869bbea29c..b66efcdce9 100755

Checking patch t/t5318-midx.sh...
Applied patch t/t5318-midx.sh cleanly.
Checking patch t/t5318-midx.sh...
Applied patch t/t5318-midx.sh cleanly.

index at:
100755 b66efcdce98463c12572d65834228d83eef0ddb2	t/t5318-midx.sh

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).