commit - eec627068f6ed6729b1a075b6052d0e076367838
commit + 1ddd9d55d5c5f0e3df1e0f102ebbd8c9b420a0fb
blob - 4625d7a4c51cb7790551d703c3a82fc9cce4d620
blob + c21d1c02dd99282f345f37e8dc6e2cb64c1e65b5
--- gotd/session_write.c
+++ gotd/session_write.c
struct gotd_imsgev *iev = &gotd_session.notifier_iev;
struct gotd_session_notif *notif;
struct gotd_imsg_notification_content icontent;
- char *refname = NULL;
+ char *refname = NULL, *id_str = NULL;
size_t datalen;
struct gotd_imsg_notify inotify;
const char *action;
switch (notif->action) {
case GOTD_NOTIF_ACTION_CREATED:
action = "created";
+ err = got_object_id_str(&id_str, ¬if->new_id);
+ if (err)
+ goto done;
break;
case GOTD_NOTIF_ACTION_REMOVED:
action = "removed";
+ err = got_object_id_str(&id_str, ¬if->old_id);
+ if (err)
+ goto done;
break;
case GOTD_NOTIF_ACTION_CHANGED:
action = "changed";
+ err = got_object_id_str(&id_str, ¬if->new_id);
+ if (err)
+ goto done;
break;
default:
err = got_error(GOT_ERR_PRIVSEP_MSG);
sizeof(inotify.repo_name));
snprintf(inotify.subject_line, sizeof(inotify.subject_line),
- "%s: %s %s %s", gotd_session.repo_cfg->name,
- client->username, action, notif->refname);
+ "%s: %s %s %s: %.12s", gotd_session.repo_cfg->name,
+ client->username, action, notif->refname, id_str);
inotify.username_len = strlen(client->username);
wbuf = imsg_create(&iev->ibuf, GOTD_IMSG_NOTIFY,
close(notif->fd);
free(notif);
free(refname);
+ free(id_str);
return err;
}
blob - f95b00932a0932131a46023cbdd33283f82a5563
blob + 0f044fa5e9f2d09e6ac1d9c134d217185fe3fb57
--- regress/gotd/email_notification.sh
+++ regress/gotd/email_notification.sh
wait %1 # wait for nc -l
+ short_commit_id=`trim_obj_id 28 $commit_id`
HOSTNAME=`hostname`
printf "HELO localhost\r\n" > $testroot/stdout.expected
printf "MAIL FROM:<${GOTD_USER}@${HOSTNAME}>\r\n" \
printf "From: ${GOTD_USER}@${HOSTNAME}\r\n" >> $testroot/stdout.expected
printf "To: ${GOTD_DEVUSER}\r\n" >> $testroot/stdout.expected
printf "Subject: $GOTD_TEST_REPO_NAME: " >> $testroot/stdout.expected
- printf "${GOTD_DEVUSER} changed refs/heads/main\r\n" \
+ printf "${GOTD_DEVUSER} changed refs/heads/main: $short_commit_id\r\n" \
>> $testroot/stdout.expected
printf "\r\n" >> $testroot/stdout.expected
printf "commit $commit_id\n" >> $testroot/stdout.expected
wait %1 # wait for nc -l
+ short_commit_id=`trim_obj_id 28 $commit_id`
HOSTNAME=`hostname`
printf "HELO localhost\r\n" > $testroot/stdout.expected
printf "MAIL FROM:<${GOTD_USER}@${HOSTNAME}>\r\n" \
>> $testroot/stdout.expected
printf "To: ${GOTD_DEVUSER}\r\n" >> $testroot/stdout.expected
printf "Subject: $GOTD_TEST_REPO_NAME: " >> $testroot/stdout.expected
- printf "${GOTD_DEVUSER} changed refs/heads/main\r\n" \
+ printf "${GOTD_DEVUSER} changed refs/heads/main: $short_commit_id\r\n" \
>> $testroot/stdout.expected
printf "\r\n" >> $testroot/stdout.expected
for i in `seq 1 24`; do
wait %1 # wait for nc -l
+ short_commit_id=`trim_obj_id 28 $commit_id`
HOSTNAME=`hostname`
printf "HELO localhost\r\n" > $testroot/stdout.expected
printf "MAIL FROM:<${GOTD_USER}@${HOSTNAME}>\r\n" \
>> $testroot/stdout.expected
printf "To: ${GOTD_DEVUSER}\r\n" >> $testroot/stdout.expected
printf "Subject: $GOTD_TEST_REPO_NAME: " >> $testroot/stdout.expected
- printf "${GOTD_DEVUSER} changed refs/heads/main\r\n" \
+ printf "${GOTD_DEVUSER} changed refs/heads/main: $short_commit_id\r\n" \
>> $testroot/stdout.expected
printf "\r\n" >> $testroot/stdout.expected
for i in `seq 1 51`; do
wait %1 # wait for nc -l
+ short_commit_id=`trim_obj_id 28 $commit_id`
HOSTNAME=`hostname`
printf "HELO localhost\r\n" > $testroot/stdout.expected
printf "MAIL FROM:<${GOTD_USER}@${HOSTNAME}>\r\n" \
printf "From: ${GOTD_USER}@${HOSTNAME}\r\n" >> $testroot/stdout.expected
printf "To: ${GOTD_DEVUSER}\r\n" >> $testroot/stdout.expected
printf "Subject: $GOTD_TEST_REPO_NAME: " >> $testroot/stdout.expected
- printf "${GOTD_DEVUSER} created refs/heads/newbranch\r\n" \
+ printf "${GOTD_DEVUSER} created refs/heads/newbranch: $short_commit_id\r\n" \
>> $testroot/stdout.expected
printf "\r\n" >> $testroot/stdout.expected
printf "commit $commit_id\n" >> $testroot/stdout.expected
| timeout 5 nc -l "$GOTD_TEST_SMTP_PORT" > $testroot/stdout) &
local commit_id=`git_show_branch_head $testroot/repo-clone newbranch`
+ local short_commit_id=`trim_obj_id 28 $commit_id`
got send -d newbranch -q -r $testroot/repo-clone
ret=$?
printf "From: ${GOTD_USER}@${HOSTNAME}\r\n" >> $testroot/stdout.expected
printf "To: ${GOTD_DEVUSER}\r\n" >> $testroot/stdout.expected
printf "Subject: $GOTD_TEST_REPO_NAME: " >> $testroot/stdout.expected
- printf "${GOTD_DEVUSER} removed refs/heads/newbranch\r\n" \
+ printf "${GOTD_DEVUSER} removed refs/heads/newbranch: $short_commit_id\r\n" \
>> $testroot/stdout.expected
printf "\r\n" >> $testroot/stdout.expected
printf "Removed refs/heads/newbranch: $commit_id\n" \
got tag -r $testroot/repo-clone -m "new tag" 1.0 > /dev/null
local commit_id=`git_show_head $testroot/repo-clone`
local tagger_time=`git_show_tagger_time $testroot/repo-clone 1.0`
+ local tag_id=`got ref -r $testroot/repo-clone -l \
+ | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
+ local short_tag_id=`trim_obj_id 28 $tag_id`
(printf "220\r\n250\r\n250\r\n250\r\n354\r\n250\r\n221\r\n" \
| timeout 5 nc -l "$GOTD_TEST_SMTP_PORT" > $testroot/stdout) &
printf "From: ${GOTD_USER}@${HOSTNAME}\r\n" >> $testroot/stdout.expected
printf "To: ${GOTD_DEVUSER}\r\n" >> $testroot/stdout.expected
printf "Subject: $GOTD_TEST_REPO_NAME: " >> $testroot/stdout.expected
- printf "${GOTD_DEVUSER} created refs/tags/1.0\r\n" \
+ printf "${GOTD_DEVUSER} created refs/tags/1.0: $short_tag_id\r\n" \
>> $testroot/stdout.expected
printf "\r\n" >> $testroot/stdout.expected
printf "tag refs/tags/1.0\n" >> $testroot/stdout.expected
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`
+ local tag_id=`got ref -r $testroot/repo-clone -l \
+ | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
+ local short_tag_id=`trim_obj_id 28 $tag_id`
(printf "220\r\n250\r\n250\r\n250\r\n354\r\n250\r\n221\r\n" \
| timeout 5 nc -l "$GOTD_TEST_SMTP_PORT" > $testroot/stdout) &
printf "From: ${GOTD_USER}@${HOSTNAME}\r\n" >> $testroot/stdout.expected
printf "To: ${GOTD_DEVUSER}\r\n" >> $testroot/stdout.expected
printf "Subject: $GOTD_TEST_REPO_NAME: " >> $testroot/stdout.expected
- printf "${GOTD_DEVUSER} changed refs/tags/1.0\r\n" \
+ printf "${GOTD_DEVUSER} changed refs/tags/1.0: $short_tag_id\r\n" \
>> $testroot/stdout.expected
printf "\r\n" >> $testroot/stdout.expected
printf "tag refs/tags/1.0\n" >> $testroot/stdout.expected