]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5542-push-http-shallow.sh
Start the 2.46 cycle
[thirdparty/git.git] / t / t5542-push-http-shallow.sh
CommitLineData
afa53fe5
NA
1#!/bin/sh
2
3test_description='push from/to a shallow clone over http'
4
028cb644 5GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
334afbc7
JS
6export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
afa53fe5 8. ./test-lib.sh
afa53fe5
NA
9. "$TEST_DIRECTORY"/lib-httpd.sh
10start_httpd
11
12commit() {
13 echo "$1" >tracked &&
14 git add tracked &&
15 git commit -m "$1"
16}
17
18test_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 &&
25 (
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 &&
354
363
37EOF
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 &&
42c
43b
44EOF
45 test_cmp expect actual
46'
47
48test_expect_success 'push to shallow repo via http' '
49 git clone --bare --no-local shallow "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
50 (
51 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
52 git config http.receivepack true
53 ) &&
54 (
55 cd full &&
56 commit 9 &&
028cb644 57 git push $HTTPD_URL/smart/repo.git +main:refs/remotes/top/main
afa53fe5
NA
58 ) &&
59 (
60 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
61 git fsck &&
028cb644 62 git log --format=%s top/main >actual &&
afa53fe5
NA
63 cat <<EOF >expect &&
649
654
663
67EOF
68 test_cmp expect actual
69 )
70'
71
72test_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" &&
75 (
76 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
77 git config http.receivepack true
78 ) &&
79 commit 10 &&
028cb644 80 git push $HTTPD_URL/smart/repo.git +main:refs/remotes/top/main &&
afa53fe5
NA
81 (
82 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
83 git fsck &&
028cb644 84 git log --format=%s top/main >actual &&
afa53fe5
NA
85 cat <<EOF >expect &&
8610
874
883
892
901
91EOF
92 test_cmp expect actual
93 )
94'
95
afa53fe5 96test_done