git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / Atom feed
14c1baa73940e716a3ca2b76c38c80a643b3af54 blob 14501 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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
 
#!/bin/sh
#
# Copyright (c) 2009 Johan Herland
#

test_description='test git fast-import of notes objects'
. ./test-lib.sh


test_tick
cat >input <<INPUT_END
commit refs/heads/master
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
first commit
COMMIT

M 644 inline foo
data <<EOF
file foo in first commit
EOF

M 755 inline bar
data <<EOF
file bar in first commit
EOF

M 644 inline baz/xyzzy
data <<EOF
file baz/xyzzy in first commit
EOF

commit refs/heads/master
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
second commit
COMMIT

M 644 inline foo
data <<EOF
file foo in second commit
EOF

M 755 inline baz/xyzzy
data <<EOF
file baz/xyzzy in second commit
EOF

commit refs/heads/master
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
third commit
COMMIT

M 644 inline foo
data <<EOF
file foo in third commit
EOF

commit refs/heads/master
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
fourth commit
COMMIT

M 755 inline bar
data <<EOF
file bar in fourth commit
EOF

INPUT_END

test_expect_success 'set up master branch' '

	git fast-import <input &&
	git whatchanged master
'

commit4=$(git rev-parse refs/heads/master)
commit3=$(git rev-parse "$commit4^")
commit2=$(git rev-parse "$commit4~2")
commit1=$(git rev-parse "$commit4~3")

test_tick
cat >input <<INPUT_END
commit refs/notes/test
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
first notes commit
COMMIT

M 644 inline $commit1
data <<EOF
first note for first commit
EOF

M 755 inline $commit2
data <<EOF
first note for second commit
EOF

INPUT_END

cat >expect <<EXPECT_END
    fourth commit
    third commit
    second commit
    first note for second commit
    first commit
    first note for first commit
EXPECT_END

test_expect_success 'add notes with simple M command' '

	git fast-import <input &&
	GIT_NOTES_REF=refs/notes/test git log | grep "^    " > actual &&
	test_cmp expect actual

'

test_tick
cat >input <<INPUT_END
feature notes
commit refs/notes/test
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
second notes commit
COMMIT

from refs/notes/test^0
N inline $commit3
data <<EOF
first note for third commit
EOF

N inline $commit4
data <<EOF
first note for fourth commit
EOF

INPUT_END

cat >expect <<EXPECT_END
    fourth commit
    first note for fourth commit
    third commit
    first note for third commit
    second commit
    first note for second commit
    first commit
    first note for first commit
EXPECT_END

test_expect_success 'add notes with simple N command' '

	git fast-import <input &&
	GIT_NOTES_REF=refs/notes/test git log | grep "^    " > actual &&
	test_cmp expect actual

'

test_tick
cat >input <<INPUT_END
commit refs/notes/test
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
third notes commit
COMMIT

from refs/notes/test^0
N inline $commit1
data <<EOF
second note for first commit
EOF

N inline $commit2
data <<EOF
second note for second commit
EOF

N inline $commit3
data <<EOF
second note for third commit
EOF

N inline $commit4
data <<EOF
second note for fourth commit
EOF

INPUT_END

cat >expect <<EXPECT_END
    fourth commit
    second note for fourth commit
    third commit
    second note for third commit
    second commit
    second note for second commit
    first commit
    second note for first commit
EXPECT_END

test_expect_success 'update existing notes with N command' '

	git fast-import <input &&
	GIT_NOTES_REF=refs/notes/test git log | grep "^    " > actual &&
	test_cmp expect actual

'

test_tick
cat >input <<INPUT_END
commit refs/notes/test
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
fourth notes commit
COMMIT

from refs/notes/test^0
M 644 inline $(echo "$commit3" | sed "s|^..|&/|")
data <<EOF
prefix of note for third commit
EOF

M 644 inline $(echo "$commit4" | sed "s|^..|&/|")
data <<EOF
prefix of note for fourth commit
EOF

M 644 inline $(echo "$commit4" | sed "s|^\(..\)\(..\)|\1/\2/|")
data <<EOF
pre-prefix of note for fourth commit
EOF

N inline $commit1
data <<EOF
third note for first commit
EOF

N inline $commit2
data <<EOF
third note for second commit
EOF

N inline $commit3
data <<EOF
third note for third commit
EOF

N inline $commit4
data <<EOF
third note for fourth commit
EOF


INPUT_END

whitespace="    "

cat >expect <<EXPECT_END
    fourth commit
    pre-prefix of note for fourth commit
$whitespace
    prefix of note for fourth commit
$whitespace
    third note for fourth commit
    third commit
    prefix of note for third commit
$whitespace
    third note for third commit
    second commit
    third note for second commit
    first commit
    third note for first commit
EXPECT_END

test_expect_success 'add concatenation notes with M command' '

	git fast-import <input &&
	GIT_NOTES_REF=refs/notes/test git log | grep "^    " > actual &&
	test_cmp expect actual

'

test_tick
cat >input <<INPUT_END
commit refs/notes/test
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
fifth notes commit
COMMIT

from refs/notes/test^0
deleteall

INPUT_END

cat >expect <<EXPECT_END
    fourth commit
    third commit
    second commit
    first commit
EXPECT_END

test_expect_success 'verify that deleteall also removes notes' '

	git fast-import <input &&
	GIT_NOTES_REF=refs/notes/test git log | grep "^    " > actual &&
	test_cmp expect actual

'

test_tick
cat >input <<INPUT_END
commit refs/notes/test
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
sixth notes commit
COMMIT

from refs/notes/test^0
M 644 inline $commit1
data <<EOF
third note for first commit
EOF

M 644 inline $commit3
data <<EOF
third note for third commit
EOF

N inline $commit1
data <<EOF
fourth note for first commit
EOF

N inline $commit3
data <<EOF
fourth note for third commit
EOF

INPUT_END

cat >expect <<EXPECT_END
    fourth commit
    third commit
    fourth note for third commit
    second commit
    first commit
    fourth note for first commit
EXPECT_END

test_expect_success 'verify that later N commands override earlier M commands' '

	git fast-import <input &&
	GIT_NOTES_REF=refs/notes/test git log | grep "^    " > actual &&
	test_cmp expect actual

'

# Write fast-import commands to create the given number of commits
fast_import_commits () {
	my_ref=$1
	my_num_commits=$2
	my_append_to_file=$3
	my_i=0
	while test $my_i -lt $my_num_commits
	do
		my_i=$(($my_i + 1))
		test_tick
		cat >>"$my_append_to_file" <<INPUT_END
commit $my_ref
mark :$my_i
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
commit #$my_i
COMMIT

M 644 inline file
data <<EOF
file contents in commit #$my_i
EOF

INPUT_END
	done
}

# Write fast-import commands to create the given number of notes annotating
# the commits created by fast_import_commits()
fast_import_notes () {
	my_notes_ref=$1
	my_num_commits=$2
	my_append_to_file=$3
	my_note_append=$4
	test_tick
	cat >>"$my_append_to_file" <<INPUT_END
commit $my_notes_ref
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
committing $my_num_commits notes
COMMIT

INPUT_END

	my_i=0
	while test $my_i -lt $my_num_commits
	do
		my_i=$(($my_i + 1))
		cat >>"$my_append_to_file" <<INPUT_END
N inline :$my_i
data <<EOF
note for commit #$my_i$my_note_append
EOF

INPUT_END
	done
}


rm input expect
num_commits=400
# Create lots of commits
fast_import_commits "refs/heads/many_commits" $num_commits input
# Create one note per above commit
fast_import_notes "refs/notes/many_notes" $num_commits input
# Add a couple of non-notes as well
test_tick
cat >>input <<INPUT_END
commit refs/notes/many_notes
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
committing some non-notes to the notes tree
COMMIT

M 755 inline foobar/non-note.txt
data <<EOF
This is not a note, but rather a regular file residing in a notes tree
EOF

M 644 inline deadbeef
data <<EOF
Non-note file
EOF

M 644 inline de/adbeef
data <<EOF
Another non-note file
EOF

INPUT_END
# Finally create the expected output from all these notes and commits
i=$num_commits
while test $i -gt 0
do
	cat >>expect <<EXPECT_END
    commit #$i
    note for commit #$i
EXPECT_END
	i=$(($i - 1))
done

test_expect_success 'add lots of commits and notes' '

	git fast-import <input &&
	GIT_NOTES_REF=refs/notes/many_notes git log refs/heads/many_commits |
	    grep "^    " > actual &&
	test_cmp expect actual

'

test_expect_success 'verify that lots of notes trigger a fanout scheme' '
	hexsz=$(test_oid hexsz) &&

	# None of the entries in the top-level notes tree should be a full SHA1
	git ls-tree --name-only refs/notes/many_notes |
	while read path
	do
		if test $(expr length "$path") -ge $hexsz
		then
			return 1
		fi
	done

'

# Create another notes tree from the one above
SP=" "
cat >>input <<INPUT_END
commit refs/heads/other_commits
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
commit #$(($num_commit + 1))
COMMIT

from refs/heads/many_commits
M 644 inline file
data <<EOF
file contents in commit #$(($num_commit + 1))
EOF

commit refs/notes/other_notes
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
committing one more note on a tree imported from a previous notes tree
COMMIT

M 040000 $(git log --no-walk --format=%T refs/notes/many_notes)$SP
N inline :$(($num_commit + 1))
data <<EOF
note for commit #$(($num_commit + 1))
EOF
INPUT_END

test_expect_success 'verify that importing a notes tree respects the fanout scheme' '
	git fast-import <input &&

	# None of the entries in the top-level notes tree should be a full SHA1
	git ls-tree --name-only refs/notes/other_notes |
	while read path
	do
		if test $(expr length "$path") -ge $hexsz
		then
			return 1
		fi
	done
'

cat >>expect_non-note1 << EOF
This is not a note, but rather a regular file residing in a notes tree
EOF

cat >>expect_non-note2 << EOF
Non-note file
EOF

cat >>expect_non-note3 << EOF
Another non-note file
EOF

test_expect_success 'verify that non-notes are untouched by a fanout change' '

	git cat-file -p refs/notes/many_notes:foobar/non-note.txt > actual &&
	test_cmp expect_non-note1 actual &&
	git cat-file -p refs/notes/many_notes:deadbeef > actual &&
	test_cmp expect_non-note2 actual &&
	git cat-file -p refs/notes/many_notes:de/adbeef > actual &&
	test_cmp expect_non-note3 actual

'

# Change the notes for the three top commits
test_tick
cat >input <<INPUT_END
commit refs/notes/many_notes
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
changing notes for the top three commits
COMMIT
from refs/notes/many_notes^0
INPUT_END

rm expect
i=$num_commits
j=0
while test $j -lt 3
do
	cat >>input <<INPUT_END
N inline refs/heads/many_commits~$j
data <<EOF
changed note for commit #$i
EOF
INPUT_END
	cat >>expect <<EXPECT_END
    commit #$i
    changed note for commit #$i
EXPECT_END
	i=$(($i - 1))
	j=$(($j + 1))
done

test_expect_success 'change a few existing notes' '

	git fast-import <input &&
	GIT_NOTES_REF=refs/notes/many_notes git log -n3 refs/heads/many_commits |
	    grep "^    " > actual &&
	test_cmp expect actual

'

test_expect_success 'verify that changing notes respect existing fanout' '

	# None of the entries in the top-level notes tree should be a full SHA1
	git ls-tree --name-only refs/notes/many_notes |
	while read path
	do
		if test $(expr length "$path") -ge $hexsz
		then
			return 1
		fi
	done

'

remaining_notes=10
test_tick
cat >input <<INPUT_END
commit refs/notes/many_notes
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
removing all notes but $remaining_notes
COMMIT
from refs/notes/many_notes^0
INPUT_END

i=$(($num_commits - $remaining_notes))
for sha1 in $(git rev-list -n $i refs/heads/many_commits)
do
	cat >>input <<INPUT_END
N $ZERO_OID $sha1
INPUT_END
done

i=$num_commits
rm expect
while test $i -gt 0
do
	cat >>expect <<EXPECT_END
    commit #$i
EXPECT_END
	if test $i -le $remaining_notes
	then
		cat >>expect <<EXPECT_END
    note for commit #$i
EXPECT_END
	fi
	i=$(($i - 1))
done

test_expect_success 'remove lots of notes' '

	git fast-import <input &&
	GIT_NOTES_REF=refs/notes/many_notes git log refs/heads/many_commits |
	    grep "^    " > actual &&
	test_cmp expect actual

'

test_expect_success 'verify that removing notes trigger fanout consolidation' '
	# All entries in the top-level notes tree should be a full SHA1
	git ls-tree --name-only -r refs/notes/many_notes |
	while read path
	do
		# Explicitly ignore the non-note paths
		test "$path" = "foobar/non-note.txt" && continue
		test "$path" = "deadbeef" && continue
		test "$path" = "de/adbeef" && continue

		if test $(expr length "$path") -ne $hexsz
		then
			return 1
		fi
	done

'

test_expect_success 'verify that non-notes are untouched by a fanout change' '

	git cat-file -p refs/notes/many_notes:foobar/non-note.txt > actual &&
	test_cmp expect_non-note1 actual &&
	git cat-file -p refs/notes/many_notes:deadbeef > actual &&
	test_cmp expect_non-note2 actual &&
	git cat-file -p refs/notes/many_notes:de/adbeef > actual &&
	test_cmp expect_non-note3 actual

'


rm input expect
num_notes_refs=10
num_commits=16
some_commits=8
# Create commits
fast_import_commits "refs/heads/more_commits" $num_commits input
# Create one note per above commit per notes ref
i=0
while test $i -lt $num_notes_refs
do
	i=$(($i + 1))
	fast_import_notes "refs/notes/more_notes_$i" $num_commits input
done
# Trigger branch reloading in git-fast-import by repeating the note creation
i=0
while test $i -lt $num_notes_refs
do
	i=$(($i + 1))
	fast_import_notes "refs/notes/more_notes_$i" $some_commits input " (2)"
done
# Finally create the expected output from the notes in refs/notes/more_notes_1
i=$num_commits
while test $i -gt 0
do
	note_data="note for commit #$i"
	if test $i -le $some_commits
	then
		note_data="$note_data (2)"
	fi
	cat >>expect <<EXPECT_END
    commit #$i
    $note_data
EXPECT_END
	i=$(($i - 1))
done

test_expect_success "add notes to $num_commits commits in each of $num_notes_refs refs" '

	git fast-import --active-branches=5 <input &&
	GIT_NOTES_REF=refs/notes/more_notes_1 git log refs/heads/more_commits |
	    grep "^    " > actual &&
	test_cmp expect actual

'

test_done
debug log:

solving 14c1baa739 ...
found 14c1baa739 in https://80x24.org/mirrors/git.git

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

This inbox may be cloned and mirrored by anyone:

	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

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index 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/

code repositories for the project(s) associated with this inbox:

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

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