commit fb5636bebb6e4d59f4bbc0fd78650714474ac681 from: Omar Polo date: Wed Mar 27 15:23:22 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 - 98297eed5b9082b66f6397a0921c8d90df72cca1 commit + fb5636bebb6e4d59f4bbc0fd78650714474ac681 blob - dd5804164e193d9d006dc88c88420ec33fee5b0d blob + c0609cd0d9a7a9d4a0f2979504883cf99a757ef4 --- gotd/repo_write.c +++ gotd/repo_write.c @@ -1814,6 +1814,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 { @@ -2045,6 +2047,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