3 test_description='push from/to a shallow clone'
13 test_expect_success 'setup' '
14 git config --global transfer.fsckObjects true &&
27 git clone --no-local --depth=2 .git shallow &&
28 git --git-dir=shallow/.git log --format=%s >actual &&
33 test_cmp expect actual &&
34 git clone --no-local --depth=2 full-abc/.git shallow2 &&
35 git --git-dir=shallow2/.git log --format=%s >actual &&
40 test_cmp expect actual
43 test_expect_success 'push from shallow clone' '
47 git push ../.git +master:refs/remotes/shallow/master
49 git log --format=%s shallow/master >actual &&
58 test_cmp expect actual
61 test_expect_success 'push from shallow clone, with grafted roots' '
64 test_must_fail git push ../.git +master:refs/remotes/shallow2/master 2>err &&
65 grep "shallow2/master.*shallow update not allowed" err
67 test_must_fail git rev-parse shallow2/master &&
71 test_expect_success 'add new shallow root with receive.updateshallow on' '
72 test_config receive.shallowupdate true &&
75 git push ../.git +master:refs/remotes/shallow2/master
77 git log --format=%s shallow2/master >actual &&
83 test_cmp expect actual
86 test_expect_success 'push from shallow to shallow' '
89 git --git-dir=../shallow2/.git config receive.shallowupdate true &&
90 git push ../shallow2/.git +master:refs/remotes/shallow/master &&
91 git --git-dir=../shallow2/.git config receive.shallowupdate false
95 git log --format=%s shallow/master >actual &&
102 test_cmp expect actual
106 test_expect_success 'push from full to shallow' '
107 ! git --git-dir=shallow2/.git cat-file blob `echo 1|git hash-object --stdin` &&
109 git push shallow2/.git +master:refs/remotes/top/master &&
112 git log --format=%s top/master >actual &&
119 test_cmp expect actual &&
120 git cat-file blob `echo 1|git hash-object --stdin` >/dev/null
124 if test -n "$NO_CURL" -o -z "$GIT_TEST_HTTPD"; then
125 say 'skipping remaining tests, git built without http support'
129 LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5537'}
130 . "$TEST_DIRECTORY"/lib-httpd.sh
133 test_expect_success 'push to shallow repo via http' '
134 git clone --bare --no-local shallow "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
136 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
137 git config http.receivepack true
142 git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master
145 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
147 git log --format=%s top/master >actual &&
153 test_cmp expect actual
157 test_expect_success 'push from shallow repo via http' '
158 mv "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" shallow-upstream.git &&
159 git clone --bare --no-local full "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
161 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
162 git config http.receivepack true
165 git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master &&
167 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
169 git log --format=%s top/master >actual &&
178 test_cmp expect actual