merge-tree: accept 3 trees as arguments
[git.git] / t / t5542-push-http-shallow.sh
blobc2cc83182f9a6b8ae3aa0b2cee1b5b28fd12c7f3
1 #!/bin/sh
3 test_description='push from/to a shallow clone over http'
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
8 . ./test-lib.sh
9 . "$TEST_DIRECTORY"/lib-httpd.sh
10 start_httpd
12 commit() {
13 echo "$1" >tracked &&
14 git add tracked &&
15 git commit -m "$1"
18 test_expect_success 'setup' '
19 git config --global transfer.fsckObjects true &&
20 commit 1 &&
21 commit 2 &&
22 commit 3 &&
23 commit 4 &&
24 git clone . full &&
26 git init full-abc &&
27 cd full-abc &&
28 commit a &&
29 commit b &&
30 commit c
31 ) &&
32 git clone --no-local --depth=2 .git shallow &&
33 git --git-dir=shallow/.git log --format=%s >actual &&
34 cat <<EOF >expect &&
37 EOF
38 test_cmp expect actual &&
39 git clone --no-local --depth=2 full-abc/.git shallow2 &&
40 git --git-dir=shallow2/.git log --format=%s >actual &&
41 cat <<EOF >expect &&
44 EOF
45 test_cmp expect actual
48 test_expect_success 'push to shallow repo via http' '
49 git clone --bare --no-local shallow "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
51 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
52 git config http.receivepack true
53 ) &&
55 cd full &&
56 commit 9 &&
57 git push $HTTPD_URL/smart/repo.git +main:refs/remotes/top/main
58 ) &&
60 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
61 git fsck &&
62 git log --format=%s top/main >actual &&
63 cat <<EOF >expect &&
67 EOF
68 test_cmp expect actual
72 test_expect_success 'push from shallow repo via http' '
73 mv "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" shallow-upstream.git &&
74 git clone --bare --no-local full "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
76 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
77 git config http.receivepack true
78 ) &&
79 commit 10 &&
80 git push $HTTPD_URL/smart/repo.git +main:refs/remotes/top/main &&
82 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
83 git fsck &&
84 git log --format=%s top/main >actual &&
85 cat <<EOF >expect &&
91 EOF
92 test_cmp expect actual
96 test_done