git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob 58273219ffdf55b454e3785ca5cac2dbd2f63146 2911 bytes (raw)
name: t/t0095-bloom.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
112
113
 
#!/bin/sh

test_description='test bloom.c'
. ./test-lib.sh

test_expect_success 'compute bloom key for empty string' '
	cat >expect <<-\EOF &&
	Hashes:5615800c|5b966560|61174ab4|66983008|6c19155c|7199fab0|771ae004|
	Filter_Length:2
	Filter_Data:11|11|
	EOF
	test-tool bloom generate_filter "" >actual &&
	test_cmp expect actual
'

test_expect_success 'compute bloom key for whitespace' '
	cat >expect <<-\EOF &&
	Hashes:1bf014e6|8a91b50b|f9335530|67d4f555|d676957a|4518359f|b3b9d5c4|
	Filter_Length:2
	Filter_Data:71|8c|
	EOF
	test-tool bloom generate_filter " " >actual &&
	test_cmp expect actual
'

test_expect_success 'compute bloom key for a root level folder' '
	cat >expect <<-\EOF &&
	Hashes:1a21016f|fff1c06d|e5c27f6b|cb933e69|b163fd67|9734bc65|7d057b63|
	Filter_Length:2
	Filter_Data:a8|aa|
	EOF
	test-tool bloom generate_filter "A" >actual &&
	test_cmp expect actual
'

test_expect_success 'compute bloom key for a root level file' '
	cat >expect <<-\EOF &&
	Hashes:e2d51107|30970605|7e58fb03|cc1af001|19dce4ff|679ed9fd|b560cefb|
	Filter_Length:2
	Filter_Data:aa|a8|
	EOF
	test-tool bloom generate_filter "file.txt" >actual &&
	test_cmp expect actual
'

test_expect_success 'compute bloom key for a deep folder' '
	cat >expect <<-\EOF &&
	Hashes:864cf838|27f055cd|c993b362|6b3710f7|0cda6e8c|ae7dcc21|502129b6|
	Filter_Length:2
	Filter_Data:c6|31|
	EOF
	test-tool bloom generate_filter "A/B/C/D/E" >actual &&
	test_cmp expect actual
'

test_expect_success 'compute bloom key for a deep file' '
	cat >expect <<-\EOF &&
	Hashes:07cdf850|4af629c7|8e1e5b3e|d1468cb5|146ebe2c|5796efa3|9abf211a|
	Filter_Length:2
	Filter_Data:a9|54|
	EOF
	test-tool bloom generate_filter "A/B/C/D/E/file.txt" >actual &&
	test_cmp expect actual
'

test_expect_success 'get bloom filters for commit with no changes' '
	git init &&
	git commit --allow-empty -m "c0" &&
	cat >expect <<-\EOF &&
	Filter_Length:0
	Filter_Data:
	EOF
	test-tool bloom get_filter_for_commit "$(git rev-parse HEAD)" >actual &&
	test_cmp expect actual
'

test_expect_success 'get bloom filter for commit with 10 changes' '
	rm actual &&
	rm expect &&
	mkdir smallDir &&
	for i in $(test_seq 0 9)
	do
		echo $i >smallDir/$i
	done &&
	git add smallDir &&
	git commit -m "commit with 10 changes" &&
	cat >expect <<-\EOF &&
	Filter_Length:25
	Filter_Data:c2|0b|b8|c0|10|88|f0|1d|c1|0c|01|a4|01|28|81|80|01|30|10|d0|92|be|88|10|8a|
	EOF
	test-tool bloom get_filter_for_commit "$(git rev-parse HEAD)" >actual &&
	test_cmp expect actual
'

test_expect_success EXPENSIVE 'get bloom filter for commit with 513 changes' '
	rm actual &&
	rm expect &&
	mkdir bigDir &&
	for i in $(test_seq 0 512)
	do
		echo $i >bigDir/$i
	done &&
	git add bigDir &&
	git commit -m "commit with 513 changes" &&
	cat >expect <<-\EOF &&
	Filter_Length:0
	Filter_Data:
	EOF
	test-tool bloom get_filter_for_commit "$(git rev-parse HEAD)" >actual &&
	test_cmp expect actual
'

test_done

debug log:

solving 58273219ff ...
found 58273219ff in https://public-inbox.org/git/ba856e20-0a3c-e2d2-6744-b9abfacdc465@gmail.com/
found 424fe4fc29 in https://public-inbox.org/git/02b16d94227470059dcee2781e29ae7ae010f602.1580943390.git.gitgitgadget@gmail.com/

applying [1/2] https://public-inbox.org/git/02b16d94227470059dcee2781e29ae7ae010f602.1580943390.git.gitgitgadget@gmail.com/
diff --git a/t/t0095-bloom.sh b/t/t0095-bloom.sh
new file mode 100755
index 0000000000..424fe4fc29


applying [2/2] https://public-inbox.org/git/ba856e20-0a3c-e2d2-6744-b9abfacdc465@gmail.com/
diff --git a/t/t0095-bloom.sh b/t/t0095-bloom.sh
index 424fe4fc29..58273219ff 100755

Checking patch t/t0095-bloom.sh...
Applied patch t/t0095-bloom.sh cleanly.
Checking patch t/t0095-bloom.sh...
Applied patch t/t0095-bloom.sh cleanly.

index at:
100755 58273219ffdf55b454e3785ca5cac2dbd2f63146	t/t0095-bloom.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).