commit - 7ea1d42ff866342a8d20244d367a6f639a98d37a
commit + e93ed5cc1cbe6d2ec391971bb3599a63539851d0
blob - e0fc6e235bf2dc7339ededb292d026715f715456
blob + 1bafd105316d87c5c2e31cbd9217e6f18ce72997
--- gotd/notify.c
+++ gotd/notify.c
username = strndup(imsg->data + sizeof(inotify), inotify.username_len);
if (username == NULL)
return got_error_from_errno("strndup");
-
- if (lseek(fd, 0, SEEK_SET) == -1) {
- err = got_error_from_errno("lseek");
- goto done;
- }
-
STAILQ_FOREACH(target, &repo->notification_targets, entry) {
+ if (lseek(fd, 0, SEEK_SET) == -1) {
+ err = got_error_from_errno("lseek");
+ goto done;
+ }
switch (target->type) {
case GOTD_NOTIFICATION_VIA_EMAIL:
notify_email(target, inotify.subject_line, fd);
blob - d210ed777ad16244f17aecd012723366f8862c8c
blob + c13b67c82aa5229e4094d4cfbb6d0128f387a31d
--- regress/gotd/Makefile
+++ regress/gotd/Makefile
@$(GOTD_TRAP); sleep .5
start_gotd_http_notification: ensure_root
+ @echo 'listen on "$(GOTD_SOCK)"' > $(PWD)/gotd.conf
+ @echo "user $(GOTD_USER)" >> $(PWD)/gotd.conf
+ @echo 'repository "test-repo" {' >> $(PWD)/gotd.conf
+ @echo ' path "$(GOTD_TEST_REPO)"' >> $(PWD)/gotd.conf
+ @echo ' permit rw $(GOTD_DEVUSER)' >> $(PWD)/gotd.conf
+ @echo ' notify {' >> $(PWD)/gotd.conf
+ @echo ' url "http://localhost:${GOTD_TEST_HTTP_PORT}/" user flan password "password" insecure' >> $(PWD)/gotd.conf
+ @echo " }" >> $(PWD)/gotd.conf
+ @echo "}" >> $(PWD)/gotd.conf
+ @$(GOTD_TRAP); $(GOTD_START_CMD)
+ @$(GOTD_TRAP); sleep .5
+
+start_gotd_email_and_http_notification: ensure_root
@echo 'listen on "$(GOTD_SOCK)"' > $(PWD)/gotd.conf
@echo "user $(GOTD_USER)" >> $(PWD)/gotd.conf
@echo 'repository "test-repo" {' >> $(PWD)/gotd.conf
@echo ' permit rw $(GOTD_DEVUSER)' >> $(PWD)/gotd.conf
@echo ' notify {' >> $(PWD)/gotd.conf
@echo ' url "http://localhost:${GOTD_TEST_HTTP_PORT}/" user flan password "password" insecure' >> $(PWD)/gotd.conf
+ @echo -n ' email to ${GOTD_DEVUSER}' >> $(PWD)/gotd.conf
+ @echo ' relay 127.0.0.1 port ${GOTD_TEST_SMTP_PORT}' >> $(PWD)/gotd.conf
@echo " }" >> $(PWD)/gotd.conf
@echo "}" >> $(PWD)/gotd.conf
@$(GOTD_TRAP); $(GOTD_START_CMD)
'env $(GOTD_TEST_ENV) sh ./http_notification.sh'
@$(GOTD_STOP_CMD) 2>/dev/null
+test_email_and_http_notification: prepare_test_repo start_gotd_email_and_http_notification
+ @-$(GOTD_TRAP); su -m ${GOTD_TEST_USER} -c \
+ 'env $(GOTD_TEST_ENV) sh ./http_notification.sh test_file_changed'
+ @-$(GOTD_TRAP); su -m ${GOTD_TEST_USER} -c \
+ 'env $(GOTD_TEST_ENV) sh ./email_notification.sh test_file_changed'
+ @$(GOTD_STOP_CMD) 2>/dev/null
+
test_git_interop: prepare_test_repo start_gotd_rw
@-$(GOTD_TRAP); su ${GOTD_TEST_USER} -c \
'env $(GOTD_TEST_ENV) sh ./test_git_interop.sh'