1 : included from 6002 and others
 
   3 [ -d .git/refs/tags ] || mkdir -p .git/refs/tags
 
   7 # Answer the sha1 has associated with the tag. The tag must exist in .git or .git/refs/tags
 
  11         [ -f .git/refs/tags/$_tag ] || error "tag: \"$_tag\" does not exist"
 
  12         cat .git/refs/tags/$_tag
 
  15 # Generate a commit using the text specified to make it unique and the tree
 
  16 # named by the tag specified.
 
  22         echo $_text | git commit-tree $(tag $_tree) "$@"
 
  25 # Save the output of a command into the tag specified. Prepend
 
  26 # a substitution script for the tag onto the front of sed.script
 
  30         [ -n "$_tag" ] || error "usage: save_tag tag commit-args ..."
 
  32         "$@" >.git/refs/tags/$_tag
 
  34         echo "s/$(tag $_tag)/$_tag/g" > sed.script.tmp
 
  35         cat sed.script >> sed.script.tmp
 
  37         mv sed.script.tmp sed.script
 
  40 # Replace unhelpful sha1 hashses with their symbolic equivalents
 
  46 # Execute a command after first saving, then setting the GIT_AUTHOR_EMAIL
 
  47 # tag to a specified value. Restore the original value on return.
 
  52         _save=$GIT_AUTHOR_EMAIL
 
  54         GIT_AUTHOR_EMAIL="$_author"
 
  55         export GIT_AUTHOR_EMAIL
 
  59                 unset GIT_AUTHOR_EMAIL
 
  61                 GIT_AUTHOR_EMAIL="$_save"
 
  62                 export GIT_AUTHOR_EMAIL
 
  69         git cat-file commit $_commit | sed -n "s/^committer .*> \([0-9]*\) .*/\1/p"
 
  76     GIT_COMMITTER_DATE="$_date"
 
  77     export GIT_COMMITTER_DATE
 
  79     unset GIT_COMMITTER_DATE
 
  82 # Execute a command and suppress any error output.
 
  92         if eval "$*" | entag > $_name.actual
 
  94                 diff $_name.expected $_name.actual
 
 100 # Turn a reasonable test description into a reasonable test name.
 
 101 # All alphanums translated into -'s which are then compressed and stripped
 
 102 # from front and back.
 
 103 name_from_description()
 
 115 # Execute the test described by the first argument, by eval'ing
 
 116 # command line specified in the 2nd argument. Check the status code
 
 117 # is zero and that the output matches the stream read from
 
 119 test_output_expect_success()
 
 123         [ $# -eq 2 ] || error "usage: test_output_expect_success description test <<EOF ... EOF"
 
 124         _name=$(echo $_description | name_from_description)
 
 125         cat > $_name.expected
 
 126         test_expect_success "$_description" "check_output $_name \"$_test\""