commit - 553d83475bd124e7e5ba693c5ae9313d21d2139b
commit + cd18253299922842254cc506eb7fa85be402962d
blob - cea0c1eae414b659ded62ae15edaa4f32d24ab37
blob + 45034b29f011c8d27974a7b67e86892d53a30661
--- regress/gotd/http_notification.sh
+++ regress/gotd/http_notification.sh
test_done "$testroot" "$ret"
}
+
+test_tag_changed() {
+ local testroot=`test_init tag_changed 1`
+
+ got clone -a -q ${GOTD_TEST_REPO_URL} $testroot/repo-clone
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ echo "got clone failed unexpectedly" >&2
+ test_done "$testroot" 1
+ return 1
+ fi
+
+ got checkout -q $testroot/repo-clone $testroot/wt >/dev/null
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ echo "got checkout failed unexpectedly" >&2
+ test_done "$testroot" 1
+ return 1
+ fi
+
+ echo "change alpha" > $testroot/wt/alpha
+ (cd $testroot/wt && got commit -m 'make changes' > /dev/null)
+ local commit_id=`git_show_head $testroot/repo-clone`
+ got ref -r $testroot/repo-clone -d refs/tags/1.0 >/dev/null
+ got tag -r $testroot/repo-clone -m "new tag" 1.0 > /dev/null
+ local tagger_time=`git_show_tagger_time $testroot/repo-clone 1.0`
+
+ timeout 5 ./http-server -p "$GOTD_TEST_HTTP_PORT" \
+ > $testroot/stdout &
+
+ got send -f -t 1.0 -q -r $testroot/repo-clone
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ echo "got send failed unexpectedly" >&2
+ test_done "$testroot" "1"
+ return 1
+ fi
+
+ wait %1 # wait for the http "server"
+
+ d=`date -u -r $tagger_time +"%a %b %e %X %Y UTC"`
+
+ # XXX: at the moment this is exactly the same as the "new tag"
+ # notification
+
+ touch "$testroot/stdout.expected"
+ ed -s "$testroot/stdout.expected" <<-EOF
+ a
+ {"notifications":[{
+ "type":"tag",
+ "tag":"refs/tags/1.0",
+ "tagger":{
+ "full":"$GOT_AUTHOR",
+ "name":"$GIT_AUTHOR_NAME",
+ "mail":"$GIT_AUTHOR_EMAIL",
+ "user":"$GOT_AUTHOR_11"
+ },
+ "date":"$d",
+ "object":{
+ "type":"commit",
+ "id":"$commit_id"
+ },
+ "message":"new tag\n\n"
+ }]}
+ .
+ ,j
+ w
+ EOF
+
+ cmp -s $testroot/stdout.expected $testroot/stdout
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ diff -u $testroot/stdout.expected $testroot/stdout
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ test_done "$testroot" "$ret"
+}
+
test_parseargs "$@"
run_test test_file_changed
run_test test_bad_utf8
run_test test_branch_created
run_test test_branch_removed
run_test test_tag_created
+run_test test_tag_changed