commit - 9ea071aa8277616ed7e94d4f369ea6988a8aacfd
commit + eec627068f6ed6729b1a075b6052d0e076367838
blob - 936d588b3f5a49ce4f818a58d0f599adf5ddc0b9
blob + f0029122659d6d4bf4190d611c2223d8d4d6f55d
--- 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'