commit 24a2826aba4cf5e99c0e9ce87dccbd23d1b3862e from: Omar Polo via: Thomas Adam date: Sat Mar 30 17:21:23 2024 UTC add a messagelen field in the notifications Similar to the `got cat' output; it's needed to un-ambiguosly parse the content of the notification, which is already useful to parse the email content and invaluable for the upcoming got-notify-http. ok stsp@ commit - 0279329dccffda40b130fe1a08f888694df1238f commit + 24a2826aba4cf5e99c0e9ce87dccbd23d1b3862e blob - baf885a2ff3bb7c807406742e7ae48aca41aa678 blob + dd299b86f1969388fa94d5292d5770aa516a2d92 --- gotd/repo_write.c +++ gotd/repo_write.c @@ -1812,6 +1812,8 @@ print_commit(struct got_commit_object *commit, struct err = got_object_commit_get_logmsg(&logmsg0, commit); if (err) goto done; + + dprintf(fd, "messagelen: %zu\n", strlen(logmsg0)); logmsg = logmsg0; do { @@ -2043,6 +2045,9 @@ print_tag(struct got_object_id *id, err = got_error_from_errno("strdup"); goto done; } + + dprintf(fd, "messagelen: %zu\n", strlen(tagmsg0)); + tagmsg = tagmsg0; do { line = strsep(&tagmsg, "\n"); blob - 44052114a99b0f98370a006d3e3c691db559ceec blob + aa9556f2d9c1cf313a1ed01b11b9972e5e4b2441 --- regress/gotd/email_notification.sh +++ regress/gotd/email_notification.sh @@ -70,6 +70,7 @@ test_file_changed() { printf "from: $GOT_AUTHOR\n" >> $testroot/stdout.expected d=`date -u -r $author_time +"%a %b %e %X %Y UTC"` printf "date: $d\n" >> $testroot/stdout.expected + printf "messagelen: 14\n" >> $testroot/stdout.expected printf " \n" >> $testroot/stdout.expected printf " make changes\n \n" >> $testroot/stdout.expected printf " M alpha | 1+ 1-\n\n" >> $testroot/stdout.expected @@ -152,6 +153,7 @@ test_many_commits_not_summarized() { printf "commit $commit_id\n" >> $testroot/stdout.expected printf "from: $GOT_AUTHOR\n" >> $testroot/stdout.expected printf "date: $commit_time\n" >> $testroot/stdout.expected + printf "messagelen: 14\n" >> $testroot/stdout.expected printf " \n" >> $testroot/stdout.expected printf " make changes\n \n" >> $testroot/stdout.expected printf " M alpha | 1+ 1-\n\n" \ @@ -308,6 +310,7 @@ test_branch_created() { printf "from: $GOT_AUTHOR\n" >> $testroot/stdout.expected d=`date -u -r $author_time +"%a %b %e %X %Y UTC"` printf "date: $d\n" >> $testroot/stdout.expected + printf "messagelen: 11\n" >> $testroot/stdout.expected printf " \n" >> $testroot/stdout.expected printf " newbranch\n \n" >> $testroot/stdout.expected printf " M alpha | 1+ 1-\n\n" >> $testroot/stdout.expected @@ -430,6 +433,7 @@ test_tag_created() { d=`date -u -r $tagger_time +"%a %b %e %X %Y UTC"` printf "date: $d\n" >> $testroot/stdout.expected printf "object: commit $commit_id\n" >> $testroot/stdout.expected + printf "messagelen: 9\n" >> $testroot/stdout.expected printf " \n" >> $testroot/stdout.expected printf " new tag\n \n" >> $testroot/stdout.expected printf "\r\n" >> $testroot/stdout.expected @@ -504,6 +508,7 @@ test_tag_changed() { printf "from: $GOT_AUTHOR\n" >> $testroot/stdout.expected d=`date -u -r $tagger_time +"%a %b %e %X %Y UTC"` printf "date: $d\n" >> $testroot/stdout.expected + printf "messagelen: 8\n" >> $testroot/stdout.expected printf "object: commit $commit_id\n" >> $testroot/stdout.expected printf " \n" >> $testroot/stdout.expected printf " new tag\n \n" >> $testroot/stdout.expected