Git 2.4.5
[alt-git.git] / t / t5542-push-http-shallow.sh
blob51658331571611c568def54be28072f426c48e66
1 #!/bin/sh
3 test_description='push from/to a shallow clone over http'
5 . ./test-lib.sh
6 . "$TEST_DIRECTORY"/lib-httpd.sh
7 start_httpd
9 commit() {
10 echo "$1" >tracked &&
11 git add tracked &&
12 git commit -m "$1"
15 test_expect_success 'setup' '
16 git config --global transfer.fsckObjects true &&
17 commit 1 &&
18 commit 2 &&
19 commit 3 &&
20 commit 4 &&
21 git clone . full &&
23 git init full-abc &&
24 cd full-abc &&
25 commit a &&
26 commit b &&
27 commit c
28 ) &&
29 git clone --no-local --depth=2 .git shallow &&
30 git --git-dir=shallow/.git log --format=%s >actual &&
31 cat <<EOF >expect &&
34 EOF
35 test_cmp expect actual &&
36 git clone --no-local --depth=2 full-abc/.git shallow2 &&
37 git --git-dir=shallow2/.git log --format=%s >actual &&
38 cat <<EOF >expect &&
41 EOF
42 test_cmp expect actual
45 test_expect_success 'push to shallow repo via http' '
46 git clone --bare --no-local shallow "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
48 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
49 git config http.receivepack true
50 ) &&
52 cd full &&
53 commit 9 &&
54 git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master
55 ) &&
57 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
58 git fsck &&
59 git log --format=%s top/master >actual &&
60 cat <<EOF >expect &&
64 EOF
65 test_cmp expect actual
69 test_expect_success 'push from shallow repo via http' '
70 mv "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" shallow-upstream.git &&
71 git clone --bare --no-local full "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
73 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
74 git config http.receivepack true
75 ) &&
76 commit 10 &&
77 git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master &&
79 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
80 git fsck &&
81 git log --format=%s top/master >actual &&
82 cat <<EOF >expect &&
88 EOF
89 test_cmp expect actual
93 stop_httpd
94 test_done