t / t5542-push-http-shallow.shon commit apply: add t4137 for submodule updates (558643e)
   1#!/bin/sh
   2
   3test_description='push from/to a shallow clone over http'
   4
   5. ./test-lib.sh
   6
   7if test -n "$NO_CURL"; then
   8        say 'skipping test, git built without http support'
   9        test_done
  10fi
  11
  12. "$TEST_DIRECTORY"/lib-httpd.sh
  13start_httpd
  14
  15commit() {
  16        echo "$1" >tracked &&
  17        git add tracked &&
  18        git commit -m "$1"
  19}
  20
  21test_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 &&
  28        (
  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 &&
  384
  393
  40EOF
  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 &&
  45c
  46b
  47EOF
  48        test_cmp expect actual
  49'
  50
  51test_expect_success 'push to shallow repo via http' '
  52        git clone --bare --no-local shallow "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
  53        (
  54        cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
  55        git config http.receivepack true
  56        ) &&
  57        (
  58        cd full &&
  59        commit 9 &&
  60        git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master
  61        ) &&
  62        (
  63        cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
  64        git fsck &&
  65        git log --format=%s top/master >actual &&
  66        cat <<EOF >expect &&
  679
  684
  693
  70EOF
  71        test_cmp expect actual
  72        )
  73'
  74
  75test_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" &&
  78        (
  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 &&
  84        (
  85        cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
  86        git fsck &&
  87        git log --format=%s top/master >actual &&
  88        cat <<EOF >expect &&
  8910
  904
  913
  922
  931
  94EOF
  95        test_cmp expect actual
  96        )
  97'
  98
  99stop_httpd
 100test_done