t / t3200-branch.shon commit Fix gitweb stylesheet (c729127)
   1#!/bin/sh
   2#
   3# Copyright (c) 2005 Amos Waterland
   4#
   5
   6test_description='git branch --foo should not create bogus branch
   7
   8This test runs git branch --help and checks that the argument is properly
   9handled.  Specifically, that a bogus branch is not created.
  10'
  11. ./test-lib.sh
  12
  13test_expect_success \
  14    'prepare an trivial repository' \
  15    'echo Hello > A &&
  16     git-update-index --add A &&
  17     git-commit -m "Initial commit." &&
  18     HEAD=$(git-rev-parse --verify HEAD)'
  19
  20test_expect_success \
  21    'git branch --help should return success now.' \
  22    'git-branch --help'
  23
  24test_expect_failure \
  25    'git branch --help should not have created a bogus branch' \
  26    'test -f .git/refs/heads/--help'
  27
  28test_expect_success \
  29    'git branch abc should create a branch' \
  30    'git-branch abc && test -f .git/refs/heads/abc'
  31
  32test_expect_success \
  33    'git branch a/b/c should create a branch' \
  34    'git-branch a/b/c && test -f .git/refs/heads/a/b/c'
  35
  36cat >expect <<EOF
  370000000000000000000000000000000000000000 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000      branch: Created from HEAD
  38EOF
  39test_expect_success \
  40    'git branch -l d/e/f should create a branch and a log' \
  41        'GIT_COMMITTER_DATE="2005-05-26 23:30" \
  42     git-branch -l d/e/f &&
  43         test -f .git/refs/heads/d/e/f &&
  44         test -f .git/logs/refs/heads/d/e/f &&
  45         diff expect .git/logs/refs/heads/d/e/f'
  46
  47test_expect_success \
  48    'git branch -d d/e/f should delete a branch and a log' \
  49        'git-branch -d d/e/f &&
  50         test ! -f .git/refs/heads/d/e/f &&
  51         test ! -f .git/logs/refs/heads/d/e/f'
  52
  53cat >expect <<EOF
  540000000000000000000000000000000000000000 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000      checkout: Created from master^0
  55EOF
  56test_expect_success \
  57    'git checkout -b g/h/i -l should create a branch and a log' \
  58        'GIT_COMMITTER_DATE="2005-05-26 23:30" \
  59     git-checkout -b g/h/i -l master &&
  60         test -f .git/refs/heads/g/h/i &&
  61         test -f .git/logs/refs/heads/g/h/i &&
  62         diff expect .git/logs/refs/heads/g/h/i'
  63
  64test_done