Commit Diff


commit - f6020519d156c726a30a1be69ab736aa4bdf3d38
commit + 3c347461535dd1482d9f22df0ede0f245c092180
blob - 1f2ffba1e002969197e6b483aaa711da48333150
blob + 8e8c38fdba8ea220bb277b5edc26a7f4bffa00f2
--- gotd/session.c
+++ gotd/session.c
@@ -398,6 +398,24 @@ begin_ref_updates(struct gotd_session_client *client, 
 }
 
 static const struct got_error *
+send_notification(struct got_object_id *old_id, struct got_object_id *new_id,
+    struct got_reference *ref)
+{
+	const struct got_error *err = NULL;
+	struct gotd_imsgev *iev = &gotd_session.notifier_iev;
+
+	if (iev->ibuf.fd == -1)
+		return NULL; /* notifications unused */
+
+	if (old_id == NULL) {
+	} else if (new_id == NULL) {
+	} else {
+	}
+
+	return err;
+}
+
+static const struct got_error *
 update_ref(int *shut, struct gotd_session_client *client,
     const char *repo_path, struct imsg *imsg)
 {
@@ -452,6 +470,9 @@ update_ref(int *shut, struct gotd_session_client *clie
 			err = got_ref_write(ref, repo); /* will lock/unlock */
 			if (err)
 				goto done;
+			err = send_notification(NULL, &new_id, ref);
+			if (err)
+				goto done;
 		} else {
 			err = got_ref_resolve(&id, repo, ref);
 			if (err)
@@ -491,7 +512,9 @@ update_ref(int *shut, struct gotd_session_client *clie
 		err = got_ref_delete(ref, repo);
 		if (err)
 			goto done;
-
+		err = send_notification(&old_id, NULL, ref);
+		if (err)
+			goto done;
 		free(id);
 		id = NULL;
 	} else {
@@ -520,10 +543,12 @@ update_ref(int *shut, struct gotd_session_client *clie
 			err = got_ref_change_ref(ref, &new_id);
 			if (err)
 				goto done;
-
 			err = got_ref_write(ref, repo);
 			if (err)
 				goto done;
+			err = send_notification(&old_id, &new_id, ref);
+			if (err)
+				goto done;
 		}
 
 		free(id);