msysGit-based Git for Windows 1.x was superseded by Git for Windows 2.x
[git/mingw/4msysgit.git] / t / t5542-push-http-shallow.sh
blob2a691e09ebe5f35e5a1aff6c710e6b4dc525f0d6
1 #!/bin/sh
3 test_description='push from/to a shallow clone over http'
5 . ./test-lib.sh
7 if test -n "$NO_CURL"; then
8 say 'skipping test, git built without http support'
9 test_done
12 . "$TEST_DIRECTORY"/lib-httpd.sh
13 start_httpd
15 commit() {
16 echo "$1" >tracked &&
17 git add tracked &&
18 git commit -m "$1"
21 test_expect_success 'setup' '
22 git config --global transfer.fsckObjects true &&
23 commit 1 &&
24 commit 2 &&
25 commit 3 &&
26 commit 4 &&
27 git clone . full &&
29 git init full-abc &&
30 cd full-abc &&
31 commit a &&
32 commit b &&
33 commit c
34 ) &&
35 git clone --no-local --depth=2 .git shallow &&
36 git --git-dir=shallow/.git log --format=%s >actual &&
37 cat <<EOF >expect &&
40 EOF
41 test_cmp expect actual &&
42 git clone --no-local --depth=2 full-abc/.git shallow2 &&
43 git --git-dir=shallow2/.git log --format=%s >actual &&
44 cat <<EOF >expect &&
47 EOF
48 test_cmp expect actual
51 test_expect_success 'push to shallow repo via http' '
52 git clone --bare --no-local shallow "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
54 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
55 git config http.receivepack true
56 ) &&
58 cd full &&
59 commit 9 &&
60 git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master
61 ) &&
63 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
64 git fsck &&
65 git log --format=%s top/master >actual &&
66 cat <<EOF >expect &&
70 EOF
71 test_cmp expect actual
75 test_expect_success 'push from shallow repo via http' '
76 mv "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" shallow-upstream.git &&
77 git clone --bare --no-local full "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
79 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
80 git config http.receivepack true
81 ) &&
82 commit 10 &&
83 git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master &&
85 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
86 git fsck &&
87 git log --format=%s top/master >actual &&
88 cat <<EOF >expect &&
94 EOF
95 test_cmp expect actual
99 stop_httpd
100 test_done