Do not strip CR when grepping HTTP headers.
[git/dscho.git] / t / t5526-fetch-submodules.sh
blob489ef1a9334b84513d2eafa2ad0b2c3b769fcc69
1 #!/bin/sh
2 # Copyright (c) 2010, Jens Lehmann
4 test_description='Recursive "git fetch" for submodules'
6 . ./test-lib.sh
8 pwd=$(pwd)
10 add_upstream_commit() {
12 cd submodule &&
13 head1=$(git rev-parse --short HEAD) &&
14 echo new >> subfile &&
15 test_tick &&
16 git add subfile &&
17 git commit -m new subfile &&
18 head2=$(git rev-parse --short HEAD) &&
19 echo "From $pwd/submodule" > ../expect.err
20 echo " $head1..$head2 master -> origin/master" >> ../expect.err
24 test_expect_success setup '
25 mkdir submodule &&
27 cd submodule &&
28 git init &&
29 echo subcontent > subfile &&
30 git add subfile &&
31 git commit -m new subfile
32 ) &&
33 git submodule add "$pwd/submodule" submodule &&
34 git commit -am initial &&
35 git clone . downstream &&
37 cd downstream &&
38 git submodule init &&
39 git submodule update
40 ) &&
41 echo "Fetching submodule submodule" > expect.out
44 test_expect_success "fetch recurses into submodules" '
45 add_upstream_commit &&
47 cd downstream &&
48 git fetch >../actual.out 2>../actual.err
49 ) &&
50 test_cmp expect.out actual.out &&
51 test_cmp expect.err actual.err
54 test_expect_success "fetch --no-recursive only fetches superproject" '
56 cd downstream &&
57 git fetch --no-recursive >../actual.out 2>../actual.err
58 ) &&
59 ! test -s actual.out &&
60 ! test -s actual.err
63 test_expect_success "using fetch=false in .gitmodules only fetches superproject" '
65 cd downstream &&
66 git config -f .gitmodules submodule.submodule.fetch false &&
67 git fetch >../actual.out 2>../actual.err
68 ) &&
69 ! test -s actual.out &&
70 ! test -s actual.err
73 test_expect_success "--recursive overrides .gitmodules config" '
74 add_upstream_commit &&
76 cd downstream &&
77 git fetch --recursive >../actual.out 2>../actual.err
78 ) &&
79 test_cmp expect.out actual.out &&
80 test_cmp expect.err actual.err
83 test_expect_success "using fetch=true in .git/config overrides setting in .gitmodules" '
84 add_upstream_commit &&
86 cd downstream &&
87 git config submodule.submodule.fetch true &&
88 git fetch >../actual.out 2>../actual.err
89 ) &&
90 test_cmp expect.out actual.out &&
91 test_cmp expect.err actual.err
94 test_expect_success "--no-recursive overrides fetch setting from .git/config" '
95 add_upstream_commit &&
97 cd downstream &&
98 git fetch --no-recursive >../actual.out 2>../actual.err
99 ) &&
100 ! test -s actual.out &&
101 ! test -s actual.err
104 test_done