interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / t5542-push-http-shallow.sh

96 lines · 1883 bytes Raw Blame History
1#!/bin/sh
2
3test_description='push from/to a shallow clone over http'
4
5GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8. ./test-lib.sh
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 &&
57 git push $HTTPD_URL/smart/repo.git +main:refs/remotes/top/main
58 ) &&
59 (
60 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
61 git fsck &&
62 git log --format=%s top/main >actual &&
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 &&
80 git push $HTTPD_URL/smart/repo.git +main:refs/remotes/top/main &&
81 (
82 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
83 git fsck &&
84 git log --format=%s top/main >actual &&
85 cat <<EOF >expect &&
8610
874
883
892
901
91EOF
92 test_cmp expect actual
93 )
94'
95
96test_done