t1300: document current behavior of setting options
[git/debian.git] / t / t5611-clone-config.sh
blob39329eb7a8a64b177794b83ef8828b866fead547
1 #!/bin/sh
3 test_description='tests for git clone -c key=value'
4 . ./test-lib.sh
6 test_expect_success 'clone -c sets config in cloned repo' '
7 rm -rf child &&
8 git clone -c core.foo=bar . child &&
9 echo bar >expect &&
10 git --git-dir=child/.git config core.foo >actual &&
11 test_cmp expect actual
14 test_expect_success 'clone -c can set multi-keys' '
15 rm -rf child &&
16 git clone -c core.foo=bar -c core.foo=baz . child &&
17 { echo bar; echo baz; } >expect &&
18 git --git-dir=child/.git config --get-all core.foo >actual &&
19 test_cmp expect actual
22 test_expect_success 'clone -c can set multi-keys, including some empty' '
23 rm -rf child &&
24 git clone -c credential.helper= -c credential.helper=hi . child &&
25 printf "%s\n" "" hi >expect &&
26 git --git-dir=child/.git config --get-all credential.helper >actual &&
27 test_cmp expect actual
30 test_expect_success 'clone -c without a value is boolean true' '
31 rm -rf child &&
32 git clone -c core.foo . child &&
33 echo true >expect &&
34 git --git-dir=child/.git config --bool core.foo >actual &&
35 test_cmp expect actual
38 test_expect_success 'clone -c config is available during clone' '
39 echo content >file &&
40 git add file &&
41 git commit -m one &&
42 rm -rf child &&
43 git clone -c core.autocrlf . child &&
44 printf "content\\r\\n" >expect &&
45 test_cmp expect child/file
48 # Tests for the hidden file attribute on windows
49 is_hidden () {
50 # Use the output of `attrib`, ignore the absolute path
51 case "$(attrib "$1")" in *H*?:*) return 0;; esac
52 return 1
55 test_expect_success MINGW 'clone -c core.hideDotFiles' '
56 test_commit attributes .gitattributes "" &&
57 rm -rf child &&
58 git clone -c core.hideDotFiles=false . child &&
59 ! is_hidden child/.gitattributes &&
60 rm -rf child &&
61 git clone -c core.hideDotFiles=dotGitOnly . child &&
62 ! is_hidden child/.gitattributes &&
63 rm -rf child &&
64 git clone -c core.hideDotFiles=true . child &&
65 is_hidden child/.gitattributes
68 test_done