1 [ -d .git
/refs
/tags
] || mkdir
-p .git
/refs
/tags
5 # Answer the sha1 has associated with the tag. The tag must exist in .git or .git/refs/tags
9 [ -f .git
/refs
/tags
/$_tag ] || error
"tag: \"$_tag\" does not exist"
10 cat .git
/refs
/tags
/$_tag
13 # Generate a commit using the text specified to make it unique and the tree
14 # named by the tag specified.
20 echo $_text | git-commit-tree $
(tag
$_tree) "$@"
23 # Save the output of a command into the tag specified. Prepend
24 # a substitution script for the tag onto the front of $sed_script
28 [ -n "$_tag" ] || error
"usage: save_tag tag commit-args ..."
30 "$@" >.git
/refs
/tags
/$_tag
32 sed_script
="s/$(tag $_tag)/$_tag/g
36 # Replace unhelpful sha1 hashses with their symbolic equivalents
42 # Execute a command after first saving, then setting the GIT_AUTHOR_EMAIL
43 # tag to a specified value. Restore the original value on return.
48 _save
=$GIT_AUTHOR_EMAIL
50 export GIT_AUTHOR_EMAIL
="$_author"
52 export GIT_AUTHOR_EMAIL
="$_save"
58 git-cat-file commit
$_commit |
sed -n "s/^committer .*> \([0-9]*\) .*/\1/p"
65 GIT_COMMITTER_DATE
=$_date "$@"
68 # Execute a command and suppress any error output.
78 if eval "$*" | entag
> $_name.actual
80 diff $_name.expected
$_name.actual
86 # Turn a reasonable test description into a reasonable test name.
87 # All alphanums translated into -'s which are then compressed and stripped
88 # from front and back.
89 name_from_description
()
91 tr "'" '-' |
tr '~`!@#$%^&*()_+={}[]|\;:"<>,/? ' '-' |
tr -s '-' |
tr '[A-Z]' '[a-z]' |
sed "s/^-*//;s/-*\$//"
95 # Execute the test described by the first argument, by eval'ing
96 # command line specified in the 2nd argument. Check the status code
97 # is zero and that the output matches the stream read from
99 test_output_expect_success
()
103 [ $# -eq 2 ] || error
"usage: test_output_expect_success description test <<EOF ... EOF"
104 _name
=$
(echo $_description | name_from_description
)
105 cat > $_name.expected
106 test_expect_success
"$_description" "check_output $_name \"$_test\""