1 : included from 6002 and others
5 # Answer the sha1 has associated with the tag. The tag must exist under refs/tags
8 git rev-parse --verify "refs/tags/$_tag" ||
9 error "tag: \"$_tag\" does not exist"
12 # Generate a commit using the text specified to make it unique and the tree
13 # named by the tag specified.
18 echo "$_text" | git commit-tree $(tag "$_tree") "$@"
21 # Save the output of a command into the tag specified. Prepend
22 # a substitution script for the tag onto the front of sed.script
25 test -n "$_tag" || error "usage: save_tag tag commit-args ..."
28 git update-ref "refs/tags/$_tag" $("$@")
30 echo "s/$(tag $_tag)/$_tag/g" >sed.script.tmp
31 cat sed.script >>sed.script.tmp
33 mv sed.script.tmp sed.script
36 # Replace unhelpful sha1 hashes with their symbolic equivalents
41 # Execute a command after first saving, then setting the GIT_AUTHOR_EMAIL
42 # tag to a specified value. Restore the original value on return.
46 _save=$GIT_AUTHOR_EMAIL
48 GIT_AUTHOR_EMAIL="$_author"
49 export GIT_AUTHOR_EMAIL
53 unset GIT_AUTHOR_EMAIL
55 GIT_AUTHOR_EMAIL="$_save"
56 export GIT_AUTHOR_EMAIL
62 git cat-file commit $_commit |
63 sed -n "s/^committer .*> \([0-9]*\) .*/\1/p"
66 # Assign the value of fake date to a variable, but
67 # allow fairly common "1971-08-16 00:00" to be omittd
70 ??:??:??) eval "$1='1971-08-16 $2'" ;;
71 ??:??) eval "$1='1971-08-16 00:$2'" ;;
72 ??) eval "$1='1971-08-16 00:00:$2'" ;;
77 on_committer_date () {
78 assign_fake_date GIT_COMMITTER_DATE "$1"
79 export GIT_COMMITTER_DATE
85 assign_fake_date GIT_COMMITTER_DATE "$1"
86 assign_fake_date GIT_AUTHOR_DATE "$2"
87 export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
92 # Execute a command and suppress any error output.
100 if eval "$*" | entag >"$_name.actual"
102 test_cmp "$_name.expected" "$_name.actual"
108 # Turn a reasonable test description into a reasonable test name.
109 # All alphanums translated into -'s which are then compressed and stripped
110 # from front and back.
111 name_from_description () {
122 # Execute the test described by the first argument, by eval'ing
123 # command line specified in the 2nd argument. Check the status code
124 # is zero and that the output matches the stream read from
126 test_output_expect_success()
131 error "usage: test_output_expect_success description test <<EOF ... EOF"
133 _name=$(echo $_description | name_from_description)
134 cat >"$_name.expected"
135 test_expect_success "$_description" "check_output $_name \"$_test\""