t / t5540-http-push.shon commit Documentation/git-checkout: Update summary to reflect current abilities (76ce946)
   1#!/bin/sh
   2#
   3# Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at>
   4#
   5
   6test_description='test http-push
   7
   8This test runs various sanity checks on http-push.'
   9
  10. ./test-lib.sh
  11
  12ROOT_PATH="$PWD"
  13LIB_HTTPD_DAV=t
  14
  15. ../lib-httpd.sh
  16
  17if ! start_httpd >&3 2>&4
  18then
  19        say "skipping test, web server setup failed"
  20        test_done
  21        exit
  22fi
  23
  24test_expect_success 'setup remote repository' '
  25        cd "$ROOT_PATH" &&
  26        mkdir test_repo &&
  27        cd test_repo &&
  28        git init &&
  29        : >path1 &&
  30        git add path1 &&
  31        test_tick &&
  32        git commit -m initial &&
  33        cd - &&
  34        git clone --bare test_repo test_repo.git &&
  35        cd test_repo.git &&
  36        git --bare update-server-info &&
  37        chmod +x hooks/post-update &&
  38        cd - &&
  39        mv test_repo.git $HTTPD_DOCUMENT_ROOT_PATH
  40'
  41        
  42test_expect_success 'clone remote repository' '
  43        cd "$ROOT_PATH" &&
  44        git clone $HTTPD_URL/test_repo.git test_repo_clone
  45'
  46
  47test_expect_success 'push to remote repository' '
  48        cd "$ROOT_PATH"/test_repo_clone &&
  49        : >path2 &&
  50        git add path2 &&
  51        test_tick &&
  52        git commit -m path2 &&
  53        git push
  54'
  55
  56test_expect_success 'create and delete remote branch' '
  57        cd "$ROOT_PATH"/test_repo_clone &&
  58        git checkout -b dev &&
  59        : >path3 &&
  60        git add path3 &&
  61        test_tick &&
  62        git commit -m dev &&
  63        git push origin dev &&
  64        git fetch &&
  65        git push origin :dev &&
  66        git branch -d -r origin/dev &&
  67        git fetch &&
  68        ! git show-ref --verify refs/remotes/origin/dev
  69'
  70
  71stop_httpd
  72
  73test_done