git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
blob 00789d7487d5ca77d054781e4f8b15fa809bcbf7 4360 bytes (raw)
name: t/t5611-clone-config.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
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
 
#!/bin/sh

test_description='tests for git clone -c key=value'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

. ./test-lib.sh

test_expect_success 'clone -c sets config in cloned repo' '
	rm -rf child &&
	git clone -c core.foo=bar . child &&
	echo bar >expect &&
	git --git-dir=child/.git config core.foo >actual &&
	test_cmp expect actual
'

test_expect_success 'clone -c can set multi-keys' '
	rm -rf child &&
	git clone -c core.foo=bar -c core.foo=baz . child &&
	{ echo bar; echo baz; } >expect &&
	git --git-dir=child/.git config --get-all core.foo >actual &&
	test_cmp expect actual
'

test_expect_success 'clone -c can set multi-keys, including some empty' '
	rm -rf child &&
	git clone -c credential.helper= -c credential.helper=hi . child &&
	printf "%s\n" "" hi >expect &&
	git --git-dir=child/.git config --get-all credential.helper >actual &&
	test_cmp expect actual
'

test_expect_success 'clone -c without a value is boolean true' '
	rm -rf child &&
	git clone -c core.foo . child &&
	echo true >expect &&
	git --git-dir=child/.git config --bool core.foo >actual &&
	test_cmp expect actual
'

test_expect_success 'clone -c config is available during clone' '
	echo content >file &&
	git add file &&
	git commit -m one &&
	rm -rf child &&
	git clone -c core.autocrlf . child &&
	printf "content\\r\\n" >expect &&
	test_cmp expect child/file
'

test_expect_success 'clone -c remote.origin.fetch=<refspec> works' '
	rm -rf child &&
	git update-ref refs/grab/it refs/heads/main &&
	git update-ref refs/leave/out refs/heads/main &&
	git clone -c "remote.origin.fetch=+refs/grab/*:refs/grab/*" . child &&
	git -C child for-each-ref --format="%(refname)" >actual &&

	cat >expect <<-\EOF &&
	refs/grab/it
	refs/heads/main
	refs/remotes/origin/HEAD
	refs/remotes/origin/main
	EOF
	test_cmp expect actual
'

test_expect_success 'git -c remote.origin.fetch=<refspec> clone works' '
	rm -rf child &&
	git -c "remote.origin.fetch=+refs/grab/*:refs/grab/*" clone . child &&
	git -C child for-each-ref --format="%(refname)" >actual &&

	cat >expect <<-\EOF &&
	refs/grab/it
	refs/heads/main
	refs/remotes/origin/HEAD
	refs/remotes/origin/main
	EOF
	test_cmp expect actual
'

test_expect_success 'clone -c remote.<remote>.fetch=<refspec> --origin=<name>' '
	rm -rf child &&
	git clone --origin=upstream \
		  -c "remote.upstream.fetch=+refs/grab/*:refs/grab/*" \
		  -c "remote.origin.fetch=+refs/leave/*:refs/leave/*" \
		  . child &&
	git -C child for-each-ref --format="%(refname)" >actual &&

	cat >expect <<-\EOF &&
	refs/grab/it
	refs/heads/main
	refs/remotes/upstream/HEAD
	refs/remotes/upstream/main
	EOF
	test_cmp expect actual
'

test_expect_success 'clone.rejectshallow=true should fail to clone' '
	rm -rf child &&
	git clone --depth=1 --no-local . child &&
	test_must_fail git -c clone.rejectshallow=true clone --no-local child out 2>err &&
	test_i18ngrep -e "source repository is shallow, reject to clone." err
'

test_expect_success 'clone.rejectshallow=false should succeed cloning' '
	rm -rf child &&
	git clone --depth=1 --no-local . child &&
	git -c clone.rejectshallow=false clone --no-local child out
'

test_expect_success 'clone.rejectshallow=true should succeed cloning normal repo' '
	rm -rf child out &&
	git clone --no-local . child &&
	git -c clone.rejectshallow=true clone --no-local child out
'

test_expect_success 'option --reject-shallow override clone.rejectshallow' '
	rm -rf child out &&
	git clone --depth=1 --no-local . child &&
	test_must_fail git clone -c clone.rejectshallow=false  --reject-shallow --no-local child out 2>err &&
	test_i18ngrep -e "source repository is shallow, reject to clone." err
'

test_expect_success ' option --no-reject-shallow override clone.rejectshallow' '
	rm -rf child &&
	git clone --depth=1 --no-local . child &&
	git -c clone.rejectshallow=true clone --no-reject-shallow --no-local child out
'

test_expect_success MINGW 'clone -c core.hideDotFiles' '
	test_commit attributes .gitattributes "" &&
	rm -rf child &&
	git clone -c core.hideDotFiles=false . child &&
	! test_path_is_hidden child/.gitattributes &&
	rm -rf child &&
	git clone -c core.hideDotFiles=dotGitOnly . child &&
	! test_path_is_hidden child/.gitattributes &&
	rm -rf child &&
	git clone -c core.hideDotFiles=true . child &&
	test_path_is_hidden child/.gitattributes
'

test_done

debug log:

solving 00789d7487d5 ...
found 00789d7487d5 in https://public-inbox.org/git/cfcfc3ec6b3742b4726301346b0c825d09aace8f.1612773119.git.gitgitgadget@gmail.com/ ||
	https://public-inbox.org/git/pull.865.v3.git.1612793576910.gitgitgadget@gmail.com/
found 68fdf5b7ce1b in https://public-inbox.org/git/2f9602495eb5455351b926a2dcbf5a5650002382.1612773119.git.gitgitgadget@gmail.com/
found 9f555b87ecdf in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100755 9f555b87ecdf4c09e2031d1ab485c33bf63a9f5f	t/t5611-clone-config.sh

applying [1/2] https://public-inbox.org/git/2f9602495eb5455351b926a2dcbf5a5650002382.1612773119.git.gitgitgadget@gmail.com/
diff --git a/t/t5611-clone-config.sh b/t/t5611-clone-config.sh
index 9f555b87ecdf..68fdf5b7ce1b 100755


applying [2/2] https://public-inbox.org/git/cfcfc3ec6b3742b4726301346b0c825d09aace8f.1612773119.git.gitgitgadget@gmail.com/
diff --git a/t/t5611-clone-config.sh b/t/t5611-clone-config.sh
index 68fdf5b7ce1b..00789d7487d5 100755

Checking patch t/t5611-clone-config.sh...
Applied patch t/t5611-clone-config.sh cleanly.
Checking patch t/t5611-clone-config.sh...
Applied patch t/t5611-clone-config.sh cleanly.

skipping https://public-inbox.org/git/pull.865.v3.git.1612793576910.gitgitgadget@gmail.com/ for 00789d7487d5
index at:
100755 00789d7487d5ca77d054781e4f8b15fa809bcbf7	t/t5611-clone-config.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).