git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
ba0738e51561b9a019e3c4629139b9dee74a15aa blob 4634 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
 
#!/bin/sh
#
# Copyright (c) 2020 Google LLC
#

test_description='reftable basics'

. ./test-lib.sh

INVALID_SHA1=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

git_init () {
	git init -b primary "$@"
}

initialize ()  {
	rm -rf .git &&
	git_init --ref-storage=reftable &&
	mv .git/hooks .git/hooks-disabled
}

test_expect_success 'SHA256 support, env' '
	rm -rf .git &&
	GIT_DEFAULT_HASH=sha256 && export GIT_DEFAULT_HASH &&
	git_init --ref-storage=reftable &&
	mv .git/hooks .git/hooks-disabled &&
	test_commit file
'

test_expect_success 'SHA256 support, option' '
	rm -rf .git &&
	git_init --ref-storage=reftable --object-format=sha256 &&
	mv .git/hooks .git/hooks-disabled &&
	test_commit file
'

test_expect_success 'delete ref' '
	initialize &&
	test_commit file &&
	SHA=$(git show-ref -s --verify HEAD) &&
	test_write_lines "$SHA refs/heads/primary" "$SHA refs/tags/file" >expect &&
	git show-ref >actual &&
	! git update-ref -d refs/tags/file $INVALID_SHA1 &&
	test_cmp expect actual &&
	git update-ref -d refs/tags/file $SHA  &&
	test_write_lines "$SHA refs/heads/primary" >expect &&
	git show-ref >actual &&
	test_cmp expect actual
'


test_expect_success 'clone calls transaction_initial_commit' '
	test_commit message1 file1 &&
	git clone . cloned &&
	(test  -f cloned/file1 || echo "Fixme.")
'

test_expect_success 'basic operation of reftable storage: commit, show-ref' '
	initialize &&
	test_commit file &&
	test_write_lines refs/heads/primary refs/tags/file >expect &&
	git show-ref &&
	git show-ref | cut -f2 -d" " >actual &&
	test_cmp actual expect
'

test_expect_success 'reflog, repack' '
	initialize &&
	for count in $(test_seq 1 10)
	do
		test_commit "number $count" file.t $count number-$count ||
		return 1
	done &&
	git pack-refs &&
	ls -1 .git/reftable >table-files &&
	test_line_count = 2 table-files &&
	git reflog refs/heads/primary >output &&
	test_line_count = 10 output &&
	grep "commit (initial): number 1" output &&
	grep "commit: number 10" output &&
	git gc &&
	git reflog refs/heads/primary >output &&
	test_line_count = 0 output
'

test_expect_success 'branch switch in reflog output' '
	initialize &&
	test_commit file1 &&
	git checkout -b branch1 &&
	test_commit file2 &&
	git checkout -b branch2 &&
	git switch - &&
	git rev-parse --symbolic-full-name HEAD >actual &&
	echo refs/heads/branch1 >expect &&
	test_cmp actual expect
'


# This matches show-ref's output
print_ref() {
	echo "$(git rev-parse "$1") $1"
}

test_expect_success 'peeled tags are stored' '
	initialize &&
	test_commit file &&
	git tag -m "annotated tag" test_tag HEAD &&
	{
		print_ref "refs/heads/primary" &&
		print_ref "refs/tags/file" &&
		print_ref "refs/tags/test_tag" &&
		print_ref "refs/tags/test_tag^{}"
	} >expect &&
	git show-ref -d >actual &&
	test_cmp expect actual
'

test_expect_success 'show-ref works on fresh repo' '
	initialize &&
	rm -rf .git &&
	git_init --ref-storage=reftable &&
	>expect &&
	! git show-ref >actual &&
	test_cmp expect actual
'

test_expect_success 'checkout unborn branch' '
	initialize &&
	git checkout -b primary
'


test_expect_success 'dir/file conflict' '
	initialize &&
	test_commit file &&
	! git branch primary/forbidden
'


test_expect_success 'do not clobber existing repo' '
	rm -rf .git &&
	git_init --ref-storage=files &&
	cat .git/HEAD >expect &&
	test_commit file &&
	(git_init --ref-storage=reftable || true) &&
	cat .git/HEAD >actual &&
	test_cmp expect actual
'

# cherry-pick uses a pseudo ref.
test_expect_success 'pseudo refs' '
	initialize &&
	test_commit message1 file1 &&
	test_commit message2 file2 &&
	git branch source &&
	git checkout HEAD^ &&
	test_commit message3 file3 &&
	git cherry-pick source &&
	test -f file2
'

# cherry-pick uses a pseudo ref.
test_expect_success 'rebase' '
	initialize &&
	test_commit message1 file1 &&
	test_commit message2 file2 &&
	git branch source &&
	git checkout HEAD^ &&
	test_commit message3 file3 &&
	git rebase source &&
	test -f file2
'

test_expect_success 'worktrees' '
	git_init --ref-storage=reftable start &&
	(cd start && test_commit file1 && git checkout -b branch1 &&
	git checkout -b branch2 &&
	git worktree add  ../wt
	) &&
	cd wt &&
	git checkout branch1 &&
	git branch
'

test_expect_success 'worktrees 2' '
	initialize &&
	test_commit file1 &&
	mkdir existing_empty &&
	git worktree add --detach existing_empty primary
'

test_expect_success 'FETCH_HEAD' '
	initialize &&
	test_commit one &&
	(git_init sub && cd sub && test_commit two) &&
	git --git-dir sub/.git rev-parse HEAD >expect &&
	git fetch sub &&
	git checkout FETCH_HEAD &&
	git rev-parse HEAD >actual &&
	test_cmp expect actual
'

test_done
debug log:

solving ba0738e51561 ...
found ba0738e51561 in https://public-inbox.org/git/2dc73bf2ec96acae12a17c719083d11401775bc3.1618255553.git.gitgitgadget@gmail.com/ ||
	https://public-inbox.org/git/bdb19af22cc7c4f3383f03f42cb4906c3ec5c5f3.1615580397.git.gitgitgadget@gmail.com/

applying [1/2] https://public-inbox.org/git/2dc73bf2ec96acae12a17c719083d11401775bc3.1618255553.git.gitgitgadget@gmail.com/
diff --git a/t/t0031-reftable.sh b/t/t0031-reftable.sh
new file mode 100755
index 000000000000..ba0738e51561

Checking patch t/t0031-reftable.sh...
Applied patch t/t0031-reftable.sh cleanly.

skipping https://public-inbox.org/git/bdb19af22cc7c4f3383f03f42cb4906c3ec5c5f3.1615580397.git.gitgitgadget@gmail.com/ for ba0738e51561
index at:
100755 ba0738e51561b9a019e3c4629139b9dee74a15aa	t/t0031-reftable.sh

Code repositories for project(s) associated with this 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).