git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob c6a4db4c59c624224bb326a23cece2248b3b0f5f 1601 bytes (raw)
name: t/t5527-fetch-odd-refs.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
 
#!/bin/sh

test_description='test fetching of oddly-named refs'
. ./test-lib.sh

# afterwards we will have:
#  HEAD - two
#  refs/for/refs/heads/main - one
#  refs/heads/main - three
test_expect_success 'setup repo with odd suffix ref' '
	echo content >file &&
	git add . &&
	git commit -m one &&
	git update-ref refs/for/refs/heads/main HEAD &&
	echo content >>file &&
	git commit -a -m two &&
	echo content >>file &&
	git commit -a -m three &&
	git checkout HEAD^
'

test_expect_success 'suffix ref is ignored during fetch' '
	git clone --bare file://"$PWD" suffix &&
	echo three >expect &&
	git --git-dir=suffix log -1 --format=%s refs/heads/main >actual &&
	test_cmp expect actual
'

test_expect_success 'try to create repo with absurdly long refname' '
	ref240=$ZERO_OID/$ZERO_OID/$ZERO_OID/$ZERO_OID/$ZERO_OID/$ZERO_OID &&
	ref1440=$ref240/$ref240/$ref240/$ref240/$ref240/$ref240 &&
	git init long &&
	(
		cd long &&
		test_commit long &&
		test_commit main
	) &&
	if git -C long update-ref refs/heads/$ref1440 long; then
		test_set_prereq LONG_REF
	else
		echo >&2 "long refs not supported"
	fi
'

test_expect_success LONG_REF 'fetch handles extremely long refname' '
	git fetch long refs/heads/*:refs/remotes/long/* &&
	cat >expect <<-\EOF &&
	long
	main
	EOF
	git for-each-ref --format="%(subject)" refs/remotes/long >actual &&
	test_cmp expect actual
'

test_expect_success LONG_REF 'push handles extremely long refname' '
	git push long :refs/heads/$ref1440 &&
	git -C long for-each-ref --format="%(subject)" refs/heads >actual &&
	echo main >expect &&
	test_cmp expect actual
'

test_done

debug log:

solving c6a4db4c59 ...
found c6a4db4c59 in https://public-inbox.org/git/3aef39320e96aad10e133f1c97a9010aa85aa894.1605221039.git.gitgitgadget@gmail.com/ ||
	https://public-inbox.org/git/4b1b1ee51f19b6625118f39ac1389b485f99290a.1605629548.git.gitgitgadget@gmail.com/
found 3b0cb98422 in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100755 3b0cb98422930891548cb45344dd226911a8063f	t/t5527-fetch-odd-refs.sh

applying [1/1] https://public-inbox.org/git/3aef39320e96aad10e133f1c97a9010aa85aa894.1605221039.git.gitgitgadget@gmail.com/
diff --git a/t/t5527-fetch-odd-refs.sh b/t/t5527-fetch-odd-refs.sh
index 3b0cb98422..c6a4db4c59 100755

Checking patch t/t5527-fetch-odd-refs.sh...
Applied patch t/t5527-fetch-odd-refs.sh cleanly.

skipping https://public-inbox.org/git/4b1b1ee51f19b6625118f39ac1389b485f99290a.1605629548.git.gitgitgadget@gmail.com/ for c6a4db4c59
index at:
100755 c6a4db4c59c624224bb326a23cece2248b3b0f5f	t/t5527-fetch-odd-refs.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).