t / t5550-http-fetch.shon commit Makefile: SunOS 5.6 portability fix (614dd90)
   1#!/bin/sh
   2
   3test_description='test dumb fetching over http via static file'
   4. ./test-lib.sh
   5
   6if test -n "$NO_CURL"; then
   7        say 'skipping test, git built without http support'
   8        test_done
   9fi
  10
  11. "$TEST_DIRECTORY"/lib-httpd.sh
  12LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5550'}
  13start_httpd
  14
  15test_expect_success 'setup repository' '
  16        echo content >file &&
  17        git add file &&
  18        git commit -m one
  19'
  20
  21test_expect_success 'create http-accessible bare repository' '
  22        mkdir "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
  23        (cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
  24         git --bare init &&
  25         echo "exec git update-server-info" >hooks/post-update &&
  26         chmod +x hooks/post-update
  27        ) &&
  28        git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
  29        git push public master:master
  30'
  31
  32test_expect_success 'clone http repository' '
  33        git clone $HTTPD_URL/dumb/repo.git clone &&
  34        test_cmp file clone/file
  35'
  36
  37test_expect_success 'fetch changes via http' '
  38        echo content >>file &&
  39        git commit -a -m two &&
  40        git push public
  41        (cd clone && git pull) &&
  42        test_cmp file clone/file
  43'
  44
  45test_expect_success 'http remote detects correct HEAD' '
  46        git push public master:other &&
  47        (cd clone &&
  48         git remote set-head origin -d &&
  49         git remote set-head origin -a &&
  50         git symbolic-ref refs/remotes/origin/HEAD > output &&
  51         echo refs/remotes/origin/master > expect &&
  52         test_cmp expect output
  53        )
  54'
  55
  56test_expect_success 'fetch packed objects' '
  57        cp -R "$HTTPD_DOCUMENT_ROOT_PATH"/repo.git "$HTTPD_DOCUMENT_ROOT_PATH"/repo_pack.git &&
  58        cd "$HTTPD_DOCUMENT_ROOT_PATH"/repo_pack.git &&
  59        git --bare repack &&
  60        git --bare prune-packed &&
  61        git clone $HTTPD_URL/dumb/repo_pack.git
  62'
  63
  64test_expect_success 'did not use upload-pack service' '
  65        grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act
  66        : >exp
  67        test_cmp exp act
  68'
  69
  70stop_httpd
  71test_done