git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / Atom feed
407838f0e8c72c5acb8513a69cdb3a88f941b1ea blob 3331 bytes (raw)

  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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
 
#!/bin/sh
#
# Copyright (c) 2018 Jiang Xin
#

test_description='git pack-redundant test'

. ./test-lib.sh

create_commits() {
	parent=
	for name in A B C D E F G H I J K L M N O P Q R
	do
		test_tick &&
		T=$(git write-tree) &&
		if test -z "$parent"
		then
			oid=$(echo $name | git commit-tree $T)
		else
			oid=$(echo $name | git commit-tree -p $parent $T)
		fi &&
		eval $name=$oid &&
		parent=$oid ||
		return 1
	done
	git update-ref refs/heads/master $R
}

create_pack_1() {
	P1=$(git -C .git/objects/pack pack-objects -q pack <<-EOF
		$T
		$A
		$B
		$C
		$D
		$E
		$F
		$R
		EOF
	) &&
	eval P$P1=P1:$P1
}

create_pack_2() {
	P2=$(git -C .git/objects/pack pack-objects -q pack <<-EOF
		$B
		$C
		$D
		$E
		$G
		$H
		$I
		EOF
	) &&
	eval P$P2=P2:$P2
}

create_pack_3() {
	P3=$(git -C .git/objects/pack pack-objects -q pack <<-EOF
		$F
		$I
		$J
		$K
		$L
		$M
		EOF
	) &&
	eval P$P3=P3:$P3
}

create_pack_4() {
	P4=$(git -C .git/objects/pack pack-objects -q pack <<-EOF
		$J
		$K
		$L
		$M
		$P
		EOF
	) &&
	eval P$P4=P4:$P4
}

create_pack_5() {
	P5=$(git -C .git/objects/pack pack-objects -q pack <<-EOF
		$G
		$H
		$N
		$O
		EOF
	) &&
	eval P$P5=P5:$P5
}

create_pack_6() {
	P6=$(git -C .git/objects/pack pack-objects -q pack <<-EOF
		$N
		$O
		$Q
		EOF
	) &&
	eval P$P6=P6:$P6
}

create_pack_7() {
	P7=$(git -C .git/objects/pack pack-objects -q pack <<-EOF
		$P
		$Q
		EOF
	) &&
	eval P$P7=P7:$P7
}

create_pack_8() {
	P8=$(git -C .git/objects/pack pack-objects -q pack <<-EOF
		$A
		EOF
	) &&
	eval P$P8=P8:$P8
}

test_expect_success 'setup' '
	create_commits
'

test_expect_success 'no redundant packs' '
	create_pack_1 && create_pack_2 && create_pack_3 &&
	git pack-redundant --all >out &&
	test_must_be_empty out
'

test_expect_success 'create pack 4, 5' '
	create_pack_4 && create_pack_5
'

cat >expected <<EOF
P2:$P2
EOF

test_expect_success 'one of pack-2/pack-3 is redundant' '
	git pack-redundant --all >out &&
	sed \
		-e "s#.*/pack-\(.*\)\.idx#\1#" \
		-e "s#.*/pack-\(.*\)\.pack#\1#" out |
		sort -u |
		while read p; do eval echo "\${P$p}"; done |
		sort >actual &&
	test_cmp expected actual
'

test_expect_success 'create pack 6, 7' '
	create_pack_6 && create_pack_7
'

# Only after calling create_pack_6, we can use $P6 variable.
cat >expected <<EOF
P2:$P2
P4:$P4
P6:$P6
EOF

test_expect_success 'pack 2, 4, and 6 are redundant' '
	git pack-redundant --all >out &&
	sed \
		-e "s#.*/pack-\(.*\)\.idx#\1#" \
		-e "s#.*/pack-\(.*\)\.pack#\1#" out |
		sort -u |
		while read p; do eval echo "\${P$p}"; done |
		sort >actual &&
	test_cmp expected actual
'

test_expect_success 'create pack 8' '
	create_pack_8
'

cat >expected <<EOF
P2:$P2
P4:$P4
P6:$P6
P8:$P8
EOF

test_expect_success 'pack-8 (subset of pack-1) is also redundant' '
	git pack-redundant --all >out &&
	sed \
		-e "s#.*/pack-\(.*\)\.idx#\1#" \
		-e "s#.*/pack-\(.*\)\.pack#\1#" out |
		sort -u |
		while read p; do eval echo "\${P$p}"; done |
		sort >actual &&
	test_cmp expected actual
'

test_expect_success 'clean loose objects' '
	git prune-packed &&
	find .git/objects -type f | sed -e "/objects\/pack\//d" >out &&
	test_must_be_empty out
'

test_expect_success 'remove redundant packs and pass fsck' '
	git pack-redundant --all | xargs rm &&
	git fsck --no-progress &&
	git pack-redundant --all >out &&
	test_must_be_empty out
'

test_done
debug log:

solving 407838f0e8 ...
found 407838f0e8 in https://public-inbox.org/git/20190112091754.30985-2-worldhello.net@gmail.com/

applying [1/1] https://public-inbox.org/git/20190112091754.30985-2-worldhello.net@gmail.com/
diff --git a/t/t5323-pack-redundant.sh b/t/t5323-pack-redundant.sh
new file mode 100755
index 0000000000..407838f0e8

Checking patch t/t5323-pack-redundant.sh...
Applied patch t/t5323-pack-redundant.sh cleanly.

index at:
100755 407838f0e8c72c5acb8513a69cdb3a88f941b1ea	t/t5323-pack-redundant.sh

git@vger.kernel.org list mirror (unofficial, one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git