t / t3210-pack-refs.shon commit lock_ref_sha1(): do not sometimes error() and sometimes die(). (5cc3cef)
   1#!/bin/sh
   2#
   3# Copyright (c) 2005 Amos Waterland
   4# Copyright (c) 2006 Christian Couder
   5#
   6
   7test_description='git pack-refs should not change the branch semantic
   8
   9This test runs git pack-refs and git show-ref and checks that the branch
  10semantic is still the same.
  11'
  12. ./test-lib.sh
  13
  14test_expect_success \
  15    'prepare a trivial repository' \
  16    'echo Hello > A &&
  17     git-update-index --add A &&
  18     git-commit -m "Initial commit." &&
  19     HEAD=$(git-rev-parse --verify HEAD)'
  20
  21SHA1=
  22
  23test_expect_success \
  24    'see if git show-ref works as expected' \
  25    'git-branch a &&
  26     SHA1=$(< .git/refs/heads/a) &&
  27     echo "$SHA1 refs/heads/a" >expect &&
  28     git-show-ref a >result &&
  29     diff expect result'
  30
  31test_expect_success \
  32    'see if a branch still exists when packed' \
  33    'git-branch b &&
  34     git-pack-refs &&
  35     rm .git/refs/heads/b &&
  36     echo "$SHA1 refs/heads/b" >expect &&
  37     git-show-ref b >result &&
  38     diff expect result'
  39
  40test_expect_failure \
  41    'git branch c/d should barf if branch c exists' \
  42    'git-branch c &&
  43     git-pack-refs &&
  44     rm .git/refs/heads/c &&
  45     git-branch c/d'
  46
  47test_expect_success \
  48    'see if a branch still exists after git pack-refs --prune' \
  49    'git-branch e &&
  50     git-pack-refs --prune &&
  51     echo "$SHA1 refs/heads/e" >expect &&
  52     git-show-ref e >result &&
  53     diff expect result'
  54
  55test_expect_failure \
  56    'see if git pack-refs --prune remove ref files' \
  57    'git-branch f &&
  58     git-pack-refs --prune &&
  59     ls .git/refs/heads/f'
  60
  61test_expect_success \
  62    'git branch g should work when git branch g/h has been deleted' \
  63    'git-branch g/h &&
  64     git-pack-refs --prune &&
  65     git-branch -d g/h &&
  66     git-branch g &&
  67     git-pack-refs &&
  68     git-branch -d g'
  69
  70test_done